<?php
/**
 * File Path: includes/taxonomies/class-mbs-taxonomy-tag.php
 *
 * Tag Taxonomy
 *
 * Flat (non-hierarchical) taxonomy for author-defined book labels such as
 * recurring characters, settings, tropes, and content advisors.
 * Intentionally distinct from mbs_genre (which carries broad marketing
 * categories like Romance or Fantasy).
 *
 * show_in_menu is false; MBS_Admin::add_menu() registers the Tags submenu
 * manually (MENU-01 pattern, same as all other MBS taxonomies).
 *
 * @package    My_Book_Showroom
 * @subpackage Includes/Taxonomies
 * @since      1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class MBS_Taxonomy_Tag {

	public static function register(): void {
		$labels = array(
			'name'                       => __( 'Tags', 'my-book-showroom' ),
			'singular_name'              => __( 'Tag', 'my-book-showroom' ),
			'menu_name'                  => __( 'Tags', 'my-book-showroom' ),
			'search_items'               => __( 'Search Tags', 'my-book-showroom' ),
			'popular_items'              => __( 'Popular Tags', 'my-book-showroom' ),
			'all_items'                  => __( 'All Tags', 'my-book-showroom' ),
			'edit_item'                  => __( 'Edit Tag', 'my-book-showroom' ),
			'update_item'                => __( 'Update Tag', 'my-book-showroom' ),
			'add_new_item'               => __( 'Add New Tag', 'my-book-showroom' ),
			'new_item_name'              => __( 'New Tag Name', 'my-book-showroom' ),
			'separate_items_with_commas' => __( 'Separate tags with commas', 'my-book-showroom' ),
			'add_or_remove_items'        => __( 'Add or remove tags', 'my-book-showroom' ),
			'choose_from_most_used'      => __( 'Choose from the most used tags', 'my-book-showroom' ),
			'not_found'                  => __( 'No tags found.', 'my-book-showroom' ),
		);

		register_taxonomy(
			MBS_TAX_TAG,
			MBS_POST_TYPE,
			array(
				'labels'            => $labels,
				'hierarchical'      => false,
				'public'            => true,
				'show_ui'           => true,
				'show_in_rest'      => true,
				'show_admin_column' => true,
				'rewrite'           => array( 'slug' => 'book-tag' ),
				// MENU-01: Prevent auto-attachment to edit.php?post_type=mbs_book.
				// MBS_Admin::add_menu() registers the Tags submenu manually.
				'show_in_menu'      => false,
				'show_in_quick_edit' => false,
			)
		);
	}
}
