*/ private const AUTOMATION_TOOL_TYPES = array( self::DESCRIPTION => 'advanced', self::TITLE => 'title', self::SEO_META => 'seo_meta', self::FAQ => 'faq', self::TAXONOMY => '', self::IMAGE_ALT => 'image_alt', ); /** * Content Review `tool` id per generator. Empty string = no review-queue * state machine, because taxonomy writes terms directly. * * @var array */ private const REVIEW_TOOLS = array( self::DESCRIPTION => 'description', self::TITLE => 'title', self::SEO_META => 'seo_meta', self::FAQ => 'faq', self::TAXONOMY => '', self::IMAGE_ALT => 'image_alt', ); /** * AppBar "Generators" area key per generator (short slug used by the * existing command palette / area registrations). * * @var array */ private const APP_BAR_KEYS = array( self::DESCRIPTION => 'desc', self::TITLE => 'title', self::SEO_META => 'seo', self::FAQ => 'faq', self::TAXONOMY => 'tax', self::IMAGE_ALT => 'alt', ); /** * Admin page slug (`admin.php?page=`) per generator's own generator * page. Single source of truth for `Api\ContentStructure\Rest\ * BlueprintRunController` (run deep links) and `Core\Services\ * ContentStructureDataBuilder` ("Open in generator" links); both * previously re-declared this same map locally. * * @var array */ private const ADMIN_SLUGS = array( self::DESCRIPTION => 'aipt-advanced-bulk-generator', self::TITLE => 'aipt-title-generator', self::SEO_META => 'aipt-seo-meta-generator', self::FAQ => 'aipt-faq-generator', self::TAXONOMY => 'aipt-taxonomy-generator', self::IMAGE_ALT => 'aipt-image-alt-generator', ); /** * REST/engine subject kind per generator. * * @var array */ private const SUBJECT_TYPES = array( self::DESCRIPTION => 'product', self::TITLE => 'product', self::SEO_META => 'product', self::FAQ => 'product', self::TAXONOMY => 'term', self::IMAGE_ALT => 'attachment', ); /** * Untranslated labels, keyed by generator. Translated lazily in label() * so this const array stays a plain string map. * * @var array */ private const LABELS = array( self::DESCRIPTION => 'Long description', self::TITLE => 'Product title', self::SEO_META => 'SEO meta', self::FAQ => 'FAQ', self::TAXONOMY => 'Category description', self::IMAGE_ALT => 'Image alt text', ); /** * All six generator keys, in canonical display order. * * @return string[] */ public static function all(): array { return array( self::DESCRIPTION, self::TITLE, self::SEO_META, self::FAQ, self::TAXONOMY, self::IMAGE_ALT, ); } /** * Whether $generator is one of the six known Blueprint generator keys. * * @param string $generator Candidate generator key. * @return bool */ public static function isValid( string $generator ): bool { return isset( self::LABELS[ $generator ] ); } /** * Human-readable, translated label for a generator key. * * @param string $generator Generator key. * @return string Translated label, or '' for an unknown key. */ public static function label( string $generator ): string { if ( ! isset( self::LABELS[ $generator ] ) ) { return ''; } switch ( $generator ) { case self::DESCRIPTION: return __( 'Long description', 'ai-product-tools' ); case self::TITLE: return __( 'Product title', 'ai-product-tools' ); case self::SEO_META: return __( 'SEO meta', 'ai-product-tools' ); case self::FAQ: return __( 'FAQ', 'ai-product-tools' ); case self::TAXONOMY: return __( 'Category description', 'ai-product-tools' ); case self::IMAGE_ALT: return __( 'Image alt text', 'ai-product-tools' ); default: return ''; } } /** * REST/engine subject kind a generator runs against. * * @param string $generator Generator key. * @return string 'product' | 'term' | 'attachment'; '' for an unknown key. */ public static function subjectType( string $generator ): string { return self::SUBJECT_TYPES[ $generator ] ?? ''; } /** * Automation `tool_type` string for a generator. * * @param string $generator Generator key. * @return string Automation tool_type, or '' when the generator has no * Automation job type (taxonomy) or is unknown. */ public static function automationToolType( string $generator ): string { return self::AUTOMATION_TOOL_TYPES[ $generator ] ?? ''; } /** * Reverse lookup from an Automation `tool_type` string to a generator key. * * @param string $tool_type Automation tool_type value. * @return string|null Generator key, or null when no generator maps to it. */ public static function fromAutomationToolType( string $tool_type ): ?string { if ( '' === $tool_type ) { return null; } $found = array_search( $tool_type, self::AUTOMATION_TOOL_TYPES, true ); return false === $found ? null : $found; } /** * Content Review `tool` id for a generator. * * @param string $generator Generator key. * @return string Review tool id, or '' when the generator has no review * queue (taxonomy) or is unknown. */ public static function reviewTool( string $generator ): string { return self::REVIEW_TOOLS[ $generator ] ?? ''; } /** * AppBar "Generators" area key for a generator. * * @param string $generator Generator key. * @return string AppBar key, or '' for an unknown generator. */ public static function appBarKey( string $generator ): string { return self::APP_BAR_KEYS[ $generator ] ?? ''; } /** * Admin page slug for a generator's own generator page. * * @param string $generator Generator key. * @return string Admin page slug, or '' for an unknown key. */ public static function adminSlug( string $generator ): string { return self::ADMIN_SLUGS[ $generator ] ?? ''; } }