<?php
/**
 * Category description step 8 language template.
 *
 * @package SAAI
 */

if ( ! defined( 'ABSPATH' ) ) {
    die( 'You are not allowed to call this page directly.' );
}

use SAAI\Helpers\Helper;

// Get available languages.
$languages = Helper::get_data_options()['languages'];

?>

<div class="saai-category-description-form-step saai-category-description-form-step-8 <?php echo ! empty( $language ) ? 'valid' : ''; ?>" data-step="8">
    <h3><?php esc_html_e( 'Language Selection', 'storeagent-ai-for-woocommerce' ); ?></h3>
    <div class="saai-category-description-form-step-content">
        <p class="saai-category-description-form-step-description"><?php esc_html_e( 'In which language would you like to generate the category description?', 'storeagent-ai-for-woocommerce' ); ?></p>

        <div class="saai-category-description-form-field">
            <select name="language" id="saai-category-description-form-field-language" class="saai-category-description-form-field-select saai-language-select">
                <option value=""><?php esc_html_e( 'Select a language', 'storeagent-ai-for-woocommerce' ); ?></option>
                <?php foreach ( $languages as $code => $label ) : ?>
                    <option value="<?php echo esc_attr( $code ); ?>" <?php selected( $language, $code ); ?>>
                        <?php echo esc_html( $label ); ?>
                    </option>
                <?php endforeach; ?>
            </select>
            <p class="saai-field-description">
                <?php esc_html_e( 'Choose "Default language" to generate content in your site\'s default language, or select a specific language for this category description.', 'storeagent-ai-for-woocommerce' ); ?>
            </p>
        </div>
    </div>
</div>
