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

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

$wp_customize->add_section(
	'aster_it_courses_header_options',
	array(
		'panel' => 'aster_it_courses_front_page_options',
		'title' => esc_html__( 'Header Options', 'aster-it-courses' ),
        'priority' => 1,
	)
);

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

// Add control for sticky header setting
$wp_customize->add_control(
	new Aster_IT_Courses_Toggle_Switch_Custom_Control(
		$wp_customize,
		'aster_it_courses_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Header', 'aster-it-courses' ),
			'section' => 'aster_it_courses_header_options',
		)
	)
);

// Enable Banner Section
$wp_customize->add_setting(
	'aster_it_courses_enable_topbar',
	array(
		'default'           => false,
		'sanitize_callback' => 'aster_it_courses_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Aster_IT_Courses_Toggle_Switch_Custom_Control(
		$wp_customize,
		'aster_it_courses_enable_topbar',
		array(
			'label'    => esc_html__( 'Enable Topbar', 'aster-it-courses' ),
			'section'  => 'aster_it_courses_header_options',
			'settings' => 'aster_it_courses_enable_topbar',
		)
	)
);

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

// Add control for sticky header setting
$wp_customize->add_control(
	new Aster_IT_Courses_Toggle_Switch_Custom_Control(
		$wp_customize,
		'aster_it_courses_enable_header_search_section',
		array(
			'label'   => esc_html__( 'Enable Search', 'aster-it-courses' ),
			'section' => 'aster_it_courses_header_options',
		)
	)
);

// Contact Section - Phone Icon.
$wp_customize->add_setting(
    'aster_it_courses_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 Aster_IT_Courses_Change_Icon_Control(
    $wp_customize, 
    'aster_it_courses_header_phone_icon',
    array(
        'label'    => __('Phone Icon','aster-it-courses'),
        'section'  => 'aster_it_courses_header_options',
        'iconset'  => 'fa',
    )
));

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

$wp_customize->add_control(
	'aster_it_courses_phone_number',
	array(
		'label'           => esc_html__( 'Phone Number', 'aster-it-courses' ),
		'section'         => 'aster_it_courses_header_options',
		'settings'        => 'aster_it_courses_phone_number',
		'type'            => 'text',
	)
);

// Topbar Section - Topbar Mail icon.
$wp_customize->add_setting(
    'aster_it_courses_email_icon',
    array(
        'default' => 'fas fa-envelope', // Set default icon here
        'sanitize_callback' => 'sanitize_text_field',
        'capability' => 'edit_theme_options',
    )
);

$wp_customize->add_control(new Aster_IT_Courses_Change_Icon_Control(
    $wp_customize, 
    'aster_it_courses_email_icon',
    array(
        'label'    => __('Topbar Email Icon','aster-it-courses'),
        'section'  => 'aster_it_courses_header_options',
        'iconset'  => 'fa',
    )
));


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

$wp_customize->add_control(
	'aster_it_courses_email_topbar_address',
	array(
		'label'           => esc_html__( 'Topbar Email', 'aster-it-courses'  ),
		'section'         => 'aster_it_courses_header_options',
		'settings'        => 'aster_it_courses_email_topbar_address',
		'type'            => 'text',
	)
);


// Header Section - Button Label.
$wp_customize->add_setting(
	'aster_it_courses_topheader_button_text',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'aster_it_courses_topheader_button_text',
	array(
		'label'           => esc_html__( 'Button Label', 'aster-it-courses'  ),
		'section'         => 'aster_it_courses_header_options',
		'settings'        => 'aster_it_courses_topheader_button_text',
		'type'            => 'text',
	)
);

// Header Section - Button Link.
$wp_customize->add_setting(
	'aster_it_courses_topheader_button_url',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'aster_it_courses_topheader_button_url',
	array(
		'label'           => esc_html__( 'Button Link', 'aster-it-courses' ),
		'section'         => 'aster_it_courses_header_options',
		'settings'        => 'aster_it_courses_topheader_button_url',
		'type'            => 'url',
	)
);

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

$wp_customize->add_control( new Aster_IT_Courses_Separator_Custom_Control( $wp_customize, 'aster_it_courses_menu_separator', array(
	'label' => __( 'Menu Settings', 'aster-it-courses' ),
	'section' => 'aster_it_courses_header_options',
	'settings' => 'aster_it_courses_menu_separator',
)));

$wp_customize->add_setting( 'aster_it_courses_menu_font_size', array(
    'default'           => 13,
    'sanitize_callback' => 'absint',
));

// Add control for site title size
$wp_customize->add_control( 'aster_it_courses_menu_font_size', array(
    'type'        => 'number',
    'section'     => 'aster_it_courses_header_options',
    'label'       => __( 'Menu Font Size ', 'aster-it-courses' ),
    'input_attrs' => array(
        'min'  => 10,
        'max'  => 100,
        'step' => 1,
    ),
));

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

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

$wp_customize->add_setting( 'aster_it_courses_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( 'aster_it_courses_menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'aster_it_courses_header_options', // Adjust the section as needed
    'label'    => __( 'Menu Text Transform', 'aster-it-courses' ),
    'choices'  => array(
        'none'       => __( 'None', 'aster-it-courses' ),
        'capitalize' => __( 'Capitalize', 'aster-it-courses' ),
        'uppercase'  => __( 'Uppercase', 'aster-it-courses' ),
        'lowercase'  => __( 'Lowercase', 'aster-it-courses' ),
    ),
) );

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'aster_it_courses_menu_text_color', 
		array(
			'label' => __('Menu Color', 'aster-it-courses'),
			'section' => 'aster_it_courses_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'aster_it_courses_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'aster-it-courses'),
			'section' => 'aster_it_courses_header_options',
		)
	)
);

// Topbar Padding Setting
$wp_customize->add_setting('aster_it_courses_topbar_padding',array(
		'default' => '',
		'sanitize_callback' => 'absint'
	)
);
$wp_customize->add_control('aster_it_courses_topbar_padding',array(
		'label' => __('Topbar Padding','aster-it-courses'),
		'section' => 'aster_it_courses_header_options',
		'type' => 'number',
		'input_attrs' => array(
			'min' => 0,
			'max' => 50,
			'step' => 1
		)
	)
);

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

$wp_customize->add_control(
	'aster_it_courses__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(ASTER_IT_COURSES_PREMIUM_PAGE) ." '>Upgrade Pro</a>
				</div>
			</div>
		",
		'section' => 'aster_it_courses_header_options'
	)
);