<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}
/**
 * @var array $data
 *
 */
$post_id = $data['post_id'] ?? '';
$develuxsct_options = $data['options'] ?? [];
$develuxsct_key = $data['key'] ?? '';
$develuxsct_gap = $data['gap'] ?? 'gap';
$develuxsct_inner_gap = $data['inner_gap'] ?? 'gap-5';
$develuxsct_class_name = $data['class_name'] ?? '';
$develuxsct_flex_direction = $data['flex_direction'] ?? 'col';
$develuxsct_flex_inner_direction = $data['flex_inner_direction'] ?? 'row';
$develuxsct_data_property = $data['data_property'] ?? '';
$develuxsct_data_dimension_unit_type = $data['data_dimension_unit_type'] ?? '';
$develuxsct_data_target = $data['data_target'] ?? '';
$develuxsct_items = $data['items'] ?? 'items-center';
$develuxsct_default_value = $data['default_value'] ?? '';
$develuxsct_value = $data['value'] ?? $develuxsct_default_value;
if( $post_id ){
    $develuxsct_value = get_post_meta($post_id, $develuxsct_key, true);
    if( $develuxsct_value === '' || $develuxsct_value === null ) {
        $develuxsct_value = $develuxsct_default_value;
    }
}

?>
<div class="label-style <?php echo esc_attr($develuxsct_gap); ?> flex flex-<?php echo esc_attr($develuxsct_flex_direction); ?> flex-wrap <?php echo esc_attr($develuxsct_items); ?> ">
    <?php
    if( $develuxsct_options ):
    foreach($develuxsct_options as $develuxsct_option): ?>
    <div class="flex flex-<?php echo esc_attr($develuxsct_flex_inner_direction); ?> <?php echo esc_attr($develuxsct_items); ?> <?php echo esc_attr($develuxsct_inner_gap); ?>">
        <label for="<?php echo esc_attr($develuxsct_option['id']) ?? ''; ?>"><?php echo esc_html($develuxsct_option['label']) ?? ''; ?></label>
        <input data-default-value="<?php echo esc_attr($develuxsct_default_value); ?>"
               data-target="<?php echo esc_attr($develuxsct_data_target); ?>"
               data-property="<?php echo esc_attr($develuxsct_data_property); ?>"
               data-unit="<?php echo esc_attr($develuxsct_data_dimension_unit_type); ?>"
               id="<?php echo esc_attr($develuxsct_option['id']) ?? ''; ?>"
               type="radio"
               class="<?php echo esc_attr($develuxsct_class_name); ?>"
               name="<?php echo esc_attr($develuxsct_key); ?>"
               value="<?php echo esc_attr($develuxsct_option['value']) ?? ''; ?>"
            <?php checked( esc_attr($develuxsct_option['value']), esc_attr($develuxsct_value) ); ?>>
    </div>
    <?php
    endforeach;
    endif;
    ?>
</div>
