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

    public function register() : void
    {
        register_post_type(self::TYPE, [
            'label' => __('Templates', 'asuka-product-designer'),
            'labels' => [
                'name' => __('Templates', 'asuka-product-designer'),
                'singular_name' => __('Template', 'asuka-product-designer'),
                'add_new_item' => __('Add Template', 'asuka-product-designer'),
                'edit_item' => __('Edit Template', 'asuka-product-designer'),
                'new_item' => __('New Template', '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-layout',
            'supports' => ['title'],
            'map_meta_cap' => true,
            'capability_type' => ['asuka_template', 'asuka_templates'],
            'capabilities' => [
                'edit_post' => 'edit_asuka_template',
                'read_post' => 'read_asuka_template',
                'delete_post' => 'delete_asuka_template',
                'edit_posts' => 'edit_asuka_templates',
                'edit_others_posts' => 'edit_others_asuka_templates',
                'publish_posts' => 'publish_asuka_templates',
                'read_private_posts' => 'read_private_asuka_templates',
                'delete_posts' => 'delete_asuka_templates',
                'delete_private_posts' => 'delete_private_asuka_templates',
                'delete_published_posts' => 'delete_published_asuka_templates',
                'delete_others_posts' => 'delete_others_asuka_templates',
                'edit_private_posts' => 'edit_private_asuka_templates',
                'edit_published_posts' => 'edit_published_asuka_templates',
                'create_posts' => 'create_asuka_templates',
            ],
        ]);
    }
}
