<?php
/**
 * Product category taxonomy.
 *
 * @package WPDudeProducts
 */

declare(strict_types=1);

namespace WPDude\Products\Products;

/**
 * Registers wpdude_dc_cat taxonomy.
 */
final class Taxonomy {

	public const TAXONOMY = 'wpdude_dc_cat';

	/**
	 * Register taxonomy.
	 */
	public static function register(): void {
		register_taxonomy(
			self::TAXONOMY,
			Post_Type::POST_TYPE,
			array(
				'labels'            => array(
					'name'          => __( 'Product Categories', 'dude-commerce' ),
					'singular_name' => __( 'Product Category', 'dude-commerce' ),
					'search_items'  => __( 'Search Categories', 'dude-commerce' ),
					'all_items'     => __( 'All Categories', 'dude-commerce' ),
					'edit_item'     => __( 'Edit Category', 'dude-commerce' ),
					'update_item'   => __( 'Update Category', 'dude-commerce' ),
					'add_new_item'  => __( 'Add New Category', 'dude-commerce' ),
					'new_item_name' => __( 'New Category Name', 'dude-commerce' ),
					'menu_name'     => __( 'Categories', 'dude-commerce' ),
				),
				'hierarchical'      => true,
				'public'            => true,
				'show_ui'           => true,
				'show_admin_column' => true,
				// Added under Dude Commerce via Menu::add_submenus().
				'show_in_menu'      => false,
				'show_in_rest'      => true,
				'rewrite'           => array(
					'slug'         => 'product-category',
					'with_front'   => false,
					'hierarchical' => true,
				),
			)
		);
	}
}
