<?php
/**
 * Title schema definition.
 *
 * @package AIPT\Api\PromptBuilder\Schemas
 * @since   2.6.0
 */

namespace AIPT\Api\PromptBuilder\Schemas;

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

/**
 * Provides the step schema for the title generator wizard.
 */
class TitleSchema {

	/**
	 * Get the schema configuration for the title generator.
	 *
	 * @return array<string, mixed> Schema configuration.
	 */
	public static function get_schema(): array {
		return array(
			'generator_type' => 'title',
			'label'          => __( 'Title Generator', 'ai-product-tools' ),
			'description'    => __( 'Build targeted title instructions that align with search intent and brand voice.', 'ai-product-tools' ),
			'prompt_mode'    => 'additional',
			'steps'          => array(
				array(
					'key'         => 'writing_tone',
					'type'        => 'multi_select',
					'label'       => __( 'Writing Tone', 'ai-product-tools' ),
					'description' => __( 'Choose up to 3 tones that match your brand voice.', 'ai-product-tools' ),
					'required'    => true,
					'options_key' => 'tones',
					'min_items'   => 1,
					'max_items'   => 3,
				),
				array(
					'key'         => 'target_audience',
					'type'        => 'multi_select',
					'label'       => __( 'Target Audience', 'ai-product-tools' ),
					'description' => __( 'Select up to 3 audience segments the title should appeal to.', 'ai-product-tools' ),
					'required'    => false,
					'options_key' => 'target_audiences',
					'max_items'   => 3,
				),
				array(
					'key'              => 'character_limit',
					'type'             => 'text_input',
					'label'            => __( 'Character Limit', 'ai-product-tools' ),
					'description'      => __( 'Define the maximum title length.', 'ai-product-tools' ),
					'required'         => true,
					'default_value'    => '60',
					'placeholder'      => __( 'e.g. 60', 'ai-product-tools' ),
					'validation_rules' => array(
						'numeric' => true,
						'min'     => 20,
						'max'     => 100,
					),
				),
				array(
					'key'         => 'title_formula',
					'type'        => 'single_select',
					'label'       => __( 'Title Formula', 'ai-product-tools' ),
					'description' => __( 'Choose a title formula to guide the structure.', 'ai-product-tools' ),
					'required'    => true,
					'options'     => array(
						array(
							'value' => 'benefit_first',
							'label' => __( 'Benefit First', 'ai-product-tools' ),
						),
						array(
							'value' => 'feature_first',
							'label' => __( 'Feature First', 'ai-product-tools' ),
						),
						array(
							'value' => 'descriptive',
							'label' => __( 'Descriptive', 'ai-product-tools' ),
						),
						array(
							'value' => 'brand_first',
							'label' => __( 'Brand First', 'ai-product-tools' ),
						),
						array(
							'value' => 'question',
							'label' => __( 'Question-based', 'ai-product-tools' ),
						),
					),
				),
				array(
					'key'           => 'language',
					'type'          => 'text_input',
					'label'         => __( 'Language', 'ai-product-tools' ),
					'description'   => __( 'Specify the language the generated title should use.', 'ai-product-tools' ),
					'required'      => true,
					'default_value' => 'English',
					'placeholder'   => __( 'e.g. English, Turkish', 'ai-product-tools' ),
				),
				array(
					'key'         => 'custom_prompt_variables',
					'type'        => 'variables_textarea',
					'label'       => __( 'Custom Prompt with Variables', 'ai-product-tools' ),
					'description' => __( 'Write custom instructions using product variables. Variables like {title}, {PRICE}, {CATEGORIES} will be replaced with actual product data during generation.', 'ai-product-tools' ),
					'required'    => false,
					'placeholder' => __( 'e.g. Focus on the {CATEGORIES} category. Highlight that the price is {PRICE} and mention the {ATTRIBUTES}.', 'ai-product-tools' ),
				),
				array(
					'key'         => 'special_instructions',
					'type'        => 'textarea',
					'label'       => __( 'Special Instructions', 'ai-product-tools' ),
					'description' => __( 'Add any extra guidance for how the title should be written.', 'ai-product-tools' ),
					'required'    => false,
					'placeholder' => __( 'Any specific requirements...', 'ai-product-tools' ),
				),
				array(
					'key'         => 'review',
					'type'        => 'review',
					'label'       => __( 'Review', 'ai-product-tools' ),
					'description' => __( 'Review your selections before generating the prompt.', 'ai-product-tools' ),
				),
			),
		);
	}
}
