<?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;

final class ThemePostType
{
    public const TYPE = 'apd_theme';

    public function register() : void
    {
        $capabilities = array_fill_keys([
            'edit_post',
            'read_post',
            'delete_post',
            'edit_posts',
            'edit_others_posts',
            'publish_posts',
            'read_private_posts',
            'delete_posts',
            'delete_private_posts',
            'delete_published_posts',
            'delete_others_posts',
            'edit_private_posts',
            'edit_published_posts',
            'create_posts',
        ], 'manage_asuka_designer');

        register_post_type(self::TYPE, [
            'label' => __('Themes', 'asuka-product-designer'),
            'labels' => [
                'name' => __('Themes', 'asuka-product-designer'),
                'singular_name' => __('Theme', 'asuka-product-designer'),
                'menu_name' => __('Themes', 'asuka-product-designer'),
                'add_new' => __('Add New', 'asuka-product-designer'),
                'add_new_item' => __('Add New Theme', 'asuka-product-designer'),
                'edit_item' => __('Edit Theme', 'asuka-product-designer'),
                'new_item' => __('New Theme', 'asuka-product-designer'),
                'view_item' => __('View Theme', 'asuka-product-designer'),
                'search_items' => __('Search Themes', 'asuka-product-designer'),
                'not_found' => __('No themes found.', 'asuka-product-designer'),
                'not_found_in_trash' => __('No themes found in Trash.', 'asuka-product-designer'),
                'all_items' => __('All Themes', 'asuka-product-designer'),
                'item_updated' => __('Theme updated.', 'asuka-product-designer'),
                'item_published' => __('Theme published.', 'asuka-product-designer'),
            ],
            'public' => false,
            'publicly_queryable' => false,
            'exclude_from_search' => true,
            'show_ui' => true,
            'show_in_menu' => false,
            'show_in_rest' => false,
            'query_var' => false,
            'rewrite' => false,
            'can_export' => true,
            'supports' => ['title', 'revisions'],
            'map_meta_cap' => false,
            'capabilities' => $capabilities,
        ]);
    }
}
