<?php
/**
 * File Path: includes/data/class-mbs-content-warning-seeder.php
 *
 * Content Warning Seeder
 *
 * Thin static facade over MBS_Flat_Taxonomy_Seeder (D-004, Session 117).
 * Populates the mbs_content_warning taxonomy with a curated standard list
 * of content advisories on first install. Runs once per install, guarded
 * by the 'mbs_content_warnings_seeded' option.
 *
 * Hooked by MBS_Plugin at init priority 20 (after taxonomy registration
 * at priority 10).
 *
 * @package    My_Book_Showroom
 * @subpackage Includes/Data
 * @since      1.0.0
 */

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

class MBS_Content_Warning_Seeder {

	/**
	 * Curated default content warnings (alphabetical).
	 * History: '1' = initial seed (9 curated advisories — F-019).
	 *
	 * @var string[]
	 */
	private const TERMS = array(
		'Animal Cruelty or Death',
		'Child Abuse / Harm to Minors',
		'Death of a Child',
		'Domestic Violence',
		'Explicit Sexual Content',
		'Graphic Violence',
		'Racism / Racial Slurs',
		'Sexual Assault',
		'Substance Abuse / Addiction',
		'Suicide / Self-Harm',
		'Violence',
		'War / Combat',
	);

	/**
	 * Seed only when the stored version is behind the target version.
	 *
	 * Called by MBS_Plugin on init priority 20.
	 *
	 * @return void
	 */
	/**
	 * Register the init p20 hook for content-warning seeding.
	 * Moved from MBS_Plugin::load_post_types_and_taxonomies() — REFACTOR-PLAN-ARCH-001 Batch C.
	 */
	public static function register_hooks(): void {
		add_action( 'init', array( __CLASS__, 'maybe_seed' ), 20 );
	}

	public static function maybe_seed(): void {
		( new MBS_Flat_Taxonomy_Seeder(
			MBS_TAX_CONTENT_WARNING,
			'mbs_content_warnings_seeded',
			'2',
			self::TERMS
		) )->maybe_seed();
	}
}
