<?php
/**
 * SEO meta 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 SEO meta generator wizard.
 */
class SeoMetaSchema {

	/**
	 * Get the schema configuration for the SEO meta generator.
	 *
	 * @return array<string, mixed> Schema configuration.
	 */
	public static function get_schema(): array {
		return array(
			'generator_type' => 'seo_meta',
			'label'          => __( 'SEO Meta Generator', 'ai-product-tools' ),
			'description'    => __( 'Create focused prompt instructions for SEO titles and meta descriptions.', '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 audiences the meta content should target.', 'ai-product-tools' ),
					'required'    => false,
					'options_key' => 'target_audiences',
					'max_items'   => 3,
				),
				array(
					'key'              => 'meta_title_limit',
					'type'             => 'text_input',
					'label'            => __( 'Meta Title Limit', 'ai-product-tools' ),
					'description'      => __( 'Define the preferred character limit for the SEO title.', 'ai-product-tools' ),
					'required'         => true,
					'default_value'    => '60',
					'placeholder'      => __( 'e.g. 60', 'ai-product-tools' ),
					'validation_rules' => array(
						'numeric' => true,
						'min'     => 20,
						'max'     => 80,
					),
				),
				array(
					'key'              => 'meta_desc_limit',
					'type'             => 'text_input',
					'label'            => __( 'Meta Description Limit', 'ai-product-tools' ),
					'description'      => __( 'Define the preferred character limit for the meta description.', 'ai-product-tools' ),
					'required'         => true,
					'default_value'    => '160',
					'placeholder'      => __( 'e.g. 160', 'ai-product-tools' ),
					'validation_rules' => array(
						'numeric' => true,
						'min'     => 50,
						'max'     => 200,
					),
				),
			array(
				'key'           => 'seo_focus',
				'type'          => 'single_select',
				'label'         => __( 'SEO Focus', 'ai-product-tools' ),
				'description'   => __( 'Choose the primary SEO angle for the metadata.', 'ai-product-tools' ),
				'required'      => true,
				'default_value' => 'keyword',
				'options'       => array(
						array(
							'value' => 'keyword',
							'label' => __( 'Keyword-focused', 'ai-product-tools' ),
						),
						array(
							'value' => 'benefit',
							'label' => __( 'Benefit-focused', 'ai-product-tools' ),
						),
						array(
							'value' => 'question',
							'label' => __( 'Question-based', 'ai-product-tools' ),
						),
						array(
							'value' => 'comparison',
							'label' => __( 'Comparison', 'ai-product-tools' ),
						),
					),
				),
				array(
					'key'           => 'language',
					'type'          => 'text_input',
					'label'         => __( 'Language', 'ai-product-tools' ),
					'description'   => __( 'Specify the language the SEO metadata 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 the SEO meta output.', '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' ),
				),
			),
		);
	}
}
