<?php

/**
 * =============================================================================
 * @package         Blue Raven (Free Version)
 * @Plugin URI      https://enterrahost.com/plugins/blue-raven
 * 
 * @Author          EnterraHost
 * @Author URI      https://enterrahost.com
 * @License         GPL-2.0-or-later
 *  
 * @Copyright       (c) 2025 EnterraHost
 * @Contents        Area Serviced block for Main Schema Tools  
 *
 * =============================================================================
 * 
 * || INDEX:
 * ||   - SERVICE AREA BLOCK
 * ||   
 * =============================================================================
 */

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

/*
============================================================
    SERVICE AREA BLOCK
============================================================
*/

$area_id = isset($area_id) ? esc_attr($area_id) : uniqid('area_');

?>

<div class="flex-sb area-block" style="margin: 16px auto;" data-area-serviced-id="<?php echo esc_attr($area_id); ?>">
    <div class="flex-sb" style="margin-bottom: 8px; width: 90%;">
        <div style="width: 48%;">
            <label>
                <p style="margin-bottom: 8px;"><strong><?php esc_html_e('Type', 'blue-raven'); ?></strong></p>
                <select id="areas-type-dropdown-<?php echo esc_attr($area_id); ?>" name="area-type[]" class="br-dropdown" style="width: 100%; padding: 0.5rem;">
                    <option value="" disabled selected><?php esc_html_e('Select a type', 'blue-raven'); ?></option>
                    <option value="AdministrativeArea"><?php esc_html_e('AdministrativeArea (e.g., country, state, province)', 'blue-raven'); ?></option>
                    <option value="GeoShape"><?php esc_html_e('GeoShape (custom geographic shape)', 'blue-raven'); ?></option>
                    <option value="Place"><?php esc_html_e('Place (e.g., city, building, park)', 'blue-raven'); ?></option>
                    <option value="Text"><?php esc_html_e('Text (e.g., "Global", "Europe")', 'blue-raven'); ?></option>
                </select>
            </label>
        </div>
        <div style="width: 48%;">
            <label>
                <p style="margin-bottom: 8px;"><strong><?php esc_html_e('Name', 'blue-raven'); ?></strong></p>
                <input type="text" name="area-name[]" placeholder="<?php esc_attr_e('Europe', 'blue-raven'); ?>" class="br-input" style="width:100%;" id="schema-name-<?php echo esc_attr($area_id); ?>">
            </label>
        </div>
    </div>

    <div style="text-align: right; margin-top: 16px; width: 5rem;">
        <a class="enterra-button open-botton remove-area" data-tool="remove-area" id="remove-area-<?php echo esc_attr($area_id); ?>" style="margin-left: 1rem; margin-top:1rem;">❌️</a>
    </div>
</div>