<?php
/**
 * Template for the product questions meta box.
 *
 * @package SAAI
 * @var array $data_sources The data sources.
 */

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

?>
<div class="saai-product-data-sources-container">
    <p class="description">
        <?php esc_html_e( 'Add additional data sources specific to this product. These will be used to provide more context for AI-generated answers.', 'storeagent-ai-for-woocommerce' ); ?>
    </p>
    <div class="data-sources-list">
        <?php foreach ( $data_sources as $index => $source ) : ?>
            <div class="data-source-item">
                <input
                    type="url"
                    name="saai_product_questions_data_sources[]"
                    value="<?php echo esc_attr( $source ); ?>"
                    class="widefat"
                    placeholder="<?php esc_attr_e( 'Enter page URL or select a post/page', 'storeagent-ai-for-woocommerce' ); ?>"
                />
                <button type="button" class="button remove-data-source">
                    <?php esc_html_e( 'Remove', 'storeagent-ai-for-woocommerce' ); ?>
                </button>
            </div>
        <?php endforeach; ?>
    </div>
    <button type="button" class="button add-data-source">
        <?php esc_html_e( 'Add Data Source', 'storeagent-ai-for-woocommerce' ); ?>
    </button>
    <?php wp_nonce_field( 'saai_product_questions_meta_box', 'saai_product_questions_nonce' ); ?>
</div>
