<?php
/**
 * Header Section Settings
 *
 * @package electrical_repair
 */

// ---------------------------------------- HEADER OPTIONS ----------------------------------------------------

$wp_customize->add_section(
	'electrical_repair_header_options',
	array(
		'panel' => 'electrical_repair_front_page_options',
		'title' => esc_html__( 'Header Options', 'electrical-repair' ),
        'priority' => 1,
	)
);

// Add setting for sticky header
$wp_customize->add_setting(
	'electrical_repair_enable_sticky_header',
	array(
		'sanitize_callback' => 'electrical_repair_sanitize_switch',
		'default'           => false,
	)
);

// Add control for sticky header setting
$wp_customize->add_control(
	new Electrical_Repair_Toggle_Switch_Custom_Control(
		$wp_customize,
		'electrical_repair_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Header', 'electrical-repair' ),
			'section' => 'electrical_repair_header_options',
		)
	)
);

// Banner Section - Enable Section.
$wp_customize->add_setting(
	'electrical_repair_enable_header_search_section',
	array(
		'default'           => true,
		'sanitize_callback' => 'electrical_repair_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Electrical_Repair_Toggle_Switch_Custom_Control(
		$wp_customize,
		'electrical_repair_enable_header_search_section',
		array(
			'label'    => esc_html__( 'Enable Search Section', 'electrical-repair' ),
			'section'  => 'electrical_repair_header_options',
			'settings' => 'electrical_repair_enable_header_search_section',
		)
	)
);

// Contact Section - Opening Timing.
$wp_customize->add_setting(
	'electrical_repair_opening_timing',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'electrical_repair_opening_timing',
	array(
		'label'           => esc_html__( 'Opening Timing', 'electrical-repair' ),
		'section'         => 'electrical_repair_header_options',
		'type'            => 'text',
	)
);

// Topbar Section - Topbar Location icon.
$wp_customize->add_setting(
    'electrical_repair_location_header_icon',
    array(
        'default' => 'fas fa-map-marker-alt', // Set default icon here
        'sanitize_callback' => 'sanitize_text_field',
        'capability' => 'edit_theme_options',
    )
);

$wp_customize->add_control(new Electrical_Repair_Change_Icon_Control(
    $wp_customize, 
    'electrical_repair_location_header_icon',
    array(
        'label'    => __('Topbar Location Icon','electrical-repair'),
        'section'  => 'electrical_repair_header_options',
        'iconset'  => 'fa',
    )
));

// Topbar Section - Topbar Mail Label.
$wp_customize->add_setting(
	'electrical_repair_email_topbar_address',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'electrical_repair_email_topbar_address',
	array(
		'label'           => esc_html__( 'Topbar Location', 'electrical-repair'  ),
		'section'         => 'electrical_repair_header_options',
		'settings'        => 'electrical_repair_email_topbar_address',
		'type'            => 'text',
	)
);

// Contact Section - Phone Icon.
$wp_customize->add_setting(
    'electrical_repair_header_phone_icon',
    array(
        'default' => 'fas fa-phone-alt', // Set default icon here
        'sanitize_callback' => 'sanitize_text_field',
        'capability' => 'edit_theme_options',
    )
);

$wp_customize->add_control(new Electrical_Repair_Change_Icon_Control(
    $wp_customize, 
    'electrical_repair_header_phone_icon',
    array(
        'label'    => __('Phone Icon','electrical-repair'),
        'section'  => 'electrical_repair_header_options',
        'iconset'  => 'fa',
    )
));

// Contact Section - Phone Number.
$wp_customize->add_setting(
	'electrical_repair_phone_number',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'electrical_repair_phone_number',
	array(
		'label'           => esc_html__( 'Phone Number', 'electrical-repair' ),
		'section'         => 'electrical_repair_header_options',
		'settings'        => 'electrical_repair_phone_number',
		'type'            => 'text',
	)
);

// Add Separator Custom Control
$wp_customize->add_setting( 'electrical_repair_menu_separator', array(
	'sanitize_callback' => 'sanitize_text_field',
) );

$wp_customize->add_control( new Electrical_Repair_Separator_Custom_Control( $wp_customize, 'electrical_repair_menu_separator', array(
	'label' => __( 'Menu Settings', 'electrical-repair' ),
	'section' => 'electrical_repair_header_options',
	'settings' => 'electrical_repair_menu_separator',
)));

$wp_customize->add_setting( 'electrical_repair_menu_font_size', array(
    'default'           => 15,
    'sanitize_callback' => 'absint',
) );

// Add control for site title size
$wp_customize->add_control( 'electrical_repair_menu_font_size', array(
    'type'        => 'number',
    'section'     => 'electrical_repair_header_options',
    'label'       => __( 'Menu Font Size ', 'electrical-repair' ),
    'input_attrs' => array(
        'min'  => 10,
        'max'  => 100,
        'step' => 1,
    ),
));

// Add setting for menu font weight
$wp_customize->add_setting('electrical_repair_menu_font_weight', array(
    'default'           => '500',
    'sanitize_callback' => 'sanitize_text_field',
));

// Add control for menu font weight
$wp_customize->add_control('electrical_repair_menu_font_weight', array(
    'type'     => 'select',
    'section'  => 'electrical_repair_header_options', 
    'label'    => __('Menu Font Weight', 'electrical-repair'),
    'choices'  => array(
		'100' => __('100','electrical-repair'),
		'200' => __('200','electrical-repair'),
		'300' => __('300','electrical-repair'),
		'400' => __('400','electrical-repair'),
		'500' => __('500','electrical-repair'),
		'600' => __('600','electrical-repair'),
		'700' => __('700','electrical-repair'),
		'800' => __('800','electrical-repair'),
		'900' => __('900','electrical-repair'),
    ),
));

// Add setting for menu text transform
$wp_customize->add_setting('electrical_repair_menu_text_transform', array(
    'default'           => 'uppercase', // Default value for text transform
    'sanitize_callback' => 'sanitize_text_field',
));

// Add control for menu text transform
$wp_customize->add_control('electrical_repair_menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'electrical_repair_header_options', // Section where the control will appear
    'label'    => __('Menu Text Transform', 'electrical-repair'),
    'choices'  => array(
        'none'       => __('None', 'electrical-repair'),
        'capitalize' => __('Capitalize', 'electrical-repair'),
        'uppercase'  => __('Uppercase', 'electrical-repair'),
        'lowercase'  => __('Lowercase', 'electrical-repair'),
    ),
));

// Menu Text Color 
$wp_customize->add_setting(
	'electrical_repair_menu_text_color', 
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'electrical_repair_menu_text_color', 
		array(
			'label' => __('Menu Color', 'electrical-repair'),
			'section' => 'electrical_repair_header_options',
		)
	)
);

// Sub Menu Text Color 
$wp_customize->add_setting(
	'electrical_repair_sub_menu_text_color', 
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'electrical_repair_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'electrical-repair'),
			'section' => 'electrical_repair_header_options',
		)
	)
);

$wp_customize->add_setting( 
	'electrical_repair_header_settings_upgraded_features',
	array(
		'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control(
	'electrical_repair_header_settings_upgraded_features', 
	array(
		'type'=> 'hidden',
		'description' => "
			<div class='customizer-upgraded-features'>
				<i class='fas fa-info-circle'></i>
				<span class='pro-text'>
					Unlock Premium <strong>Features</strong> ?<br>
					<a target='_blank' href='". esc_url(ELECTRICAL_REPAIR_PREMIUM_PAGE) ." '>Upgrade Pro</a>
				</div>
			</div>
		",
		'section' => 'electrical_repair_header_options'
	)
);