<?php

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound -- APD is the established namespace shared with the Pro add-on and retained for backward compatibility.
namespace APD\PostTypes;

defined('ABSPATH') || exit;

class UserDesignPostType
{
    public const TYPE = 'apd_user_design';

    public function register() : void
    {
        register_post_type(self::TYPE, [
            'label' => __('User Designs', 'asuka-product-designer'),
            'labels' => [
                'name' => __('User Designs', 'asuka-product-designer'),
                'singular_name' => __('User Design', 'asuka-product-designer'),
                'add_new_item' => __('Add User Design', 'asuka-product-designer'),
                'edit_item' => __('Edit User Design', 'asuka-product-designer'),
                'new_item' => __('New User Design', 'asuka-product-designer'),
            ],
            'public' => false,
            'publicly_queryable' => false,
            'exclude_from_search' => true,
            'can_export' => false,
            'show_ui' => true,
            'show_in_menu' => false,
            'show_in_rest' => false,
            'supports' => ['title', 'author'],
            'delete_with_user' => false,
            'map_meta_cap' => true,
            'capability_type' => ['asuka_user_design', 'asuka_user_designs'],
            'capabilities' => [
                'edit_post' => 'edit_asuka_user_design',
                'read_post' => 'read_asuka_user_design',
                'delete_post' => 'delete_asuka_user_design',
                'edit_posts' => 'edit_asuka_user_designs',
                'edit_others_posts' => 'edit_others_asuka_user_designs',
                'publish_posts' => 'publish_asuka_user_designs',
                'read_private_posts' => 'read_private_asuka_user_designs',
                'delete_posts' => 'delete_asuka_user_designs',
                'delete_private_posts' => 'delete_private_asuka_user_designs',
                'delete_published_posts' => 'delete_published_asuka_user_designs',
                'delete_others_posts' => 'delete_others_asuka_user_designs',
                'edit_private_posts' => 'edit_private_asuka_user_designs',
                'edit_published_posts' => 'edit_published_asuka_user_designs',
                'create_posts' => 'create_asuka_user_designs',
            ],
        ]);
    }
}
