<?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 ProductConfigPostType
{
    public const TYPE = 'apd_product_config';

    public function register() : void
    {
        register_post_type(self::TYPE, [
            'label' => __('Product Configs', 'asuka-product-designer'),
            'labels' => [
                'name' => __('Product Configs', 'asuka-product-designer'),
                'singular_name' => __('Product Config', 'asuka-product-designer'),
                'add_new_item' => __('Add Product Config', 'asuka-product-designer'),
                'edit_item' => __('Edit Product Config', 'asuka-product-designer'),
                'new_item' => __('New Product Config', '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,
            'menu_icon' => 'dashicons-screenoptions',
            'supports' => ['title'],
            'map_meta_cap' => true,
            'capability_type' => ['asuka_product_config', 'asuka_product_configs'],
            'capabilities' => [
                'edit_post' => 'edit_asuka_product_config',
                'read_post' => 'read_asuka_product_config',
                'delete_post' => 'delete_asuka_product_config',
                'edit_posts' => 'edit_asuka_product_configs',
                'edit_others_posts' => 'edit_others_asuka_product_configs',
                'publish_posts' => 'publish_asuka_product_configs',
                'read_private_posts' => 'read_private_asuka_product_configs',
                'delete_posts' => 'delete_asuka_product_configs',
                'delete_private_posts' => 'delete_private_asuka_product_configs',
                'delete_published_posts' => 'delete_published_asuka_product_configs',
                'delete_others_posts' => 'delete_others_asuka_product_configs',
                'edit_private_posts' => 'edit_private_asuka_product_configs',
                'edit_published_posts' => 'edit_published_asuka_product_configs',
                'create_posts' => 'create_asuka_product_configs',
            ],
        ]);
    }
}
