<?php
/**
 * File Path: includes/data/class-mbs-theme-seeder.php
 *
 * Theme / Trope Seeder
 *
 * Thin static facade over MBS_Flat_Taxonomy_Seeder (D-004, Session 117).
 * Populates the mbs_theme taxonomy with a curated set of default narrative
 * themes and tropes on first install. Runs once per install, guarded by
 * the 'mbs_themes_seeded' option so it never repeats on subsequent requests.
 *
 * 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_Theme_Seeder {

	/**
	 * Curated default themes / tropes (alphabetical).
	 * History: '1' = initial seed (9 curated tropes — F-019).
	 *
	 * @var string[]
	 */
	private const TERMS = array(
		'AI Rebellion',
		'Chosen One',
		'Enemies to Lovers',
		'Found Family',
		'Magic School',
		'Redemption Arc',
		'Slow Burn',
		'Time Loop',
		'Unreliable Narrator',
	);

	/**
	 * 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 theme 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_THEME,
			'mbs_themes_seeded',
			'1',
			self::TERMS
		) )->maybe_seed();
	}
}
