<?php
/**
 * Header Section
 *
 * @package online_school_courses
 */

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

$wp_customize->add_section(
	'online_school_courses_header_options',
	array(
		'panel' => 'online_school_courses_front_page_options',
		'title' => esc_html__( 'Header Options', 'online-school-courses' ),
        'priority' => 1,
	)
);


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

// Add control for sticky header setting
$wp_customize->add_control(
	new Online_School_Courses_Toggle_Switch_Custom_Control(
		$wp_customize,
		'online_school_courses_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Header', 'online-school-courses' ),
			'section' => 'online_school_courses_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new Online_School_Courses_Toggle_Switch_Custom_Control(
		$wp_customize,
		'online_school_courses_enable_topbar',
		array(
			'label'    => esc_html__( 'Enable Topbar', 'online-school-courses' ),
			'section'  => 'online_school_courses_header_options',
			'settings' => 'online_school_courses_enable_topbar',
		)
	)
);

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

// Add control for sticky header setting
$wp_customize->add_control(
	new Online_School_Courses_Toggle_Switch_Custom_Control(
		$wp_customize,
		'online_school_courses_enable_header_search_section',
		array(
			'label'   => esc_html__( 'Enable Search', 'online-school-courses' ),
			'section' => 'online_school_courses_header_options',
		)
	)
);

// Topbar Section - Topbar Mail icon.
$wp_customize->add_setting(
    'online_school_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 Online_School_Courses_Change_Icon_Control(
    $wp_customize, 
    'online_school_courses_email_icon',
    array(
        'label'    => __('Topbar Email Icon','online-school-courses'),
        'section'  => 'online_school_courses_header_options',
        'iconset'  => 'fa',
    )
));


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

$wp_customize->add_control(
	'online_school_courses_email_topbar_address',
	array(
		'label'           => esc_html__( 'Topbar Email', 'online-school-courses'  ),
		'section'         => 'online_school_courses_header_options',
		'settings'        => 'online_school_courses_email_topbar_address',
		'type'            => 'text',
	)
);

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

$wp_customize->add_control(new Online_School_Courses_Change_Icon_Control(
    $wp_customize, 
    'online_school_courses_time_icon',
    array(
        'label'    => __('Topbar Email Icon','online-school-courses'),
        'section'  => 'online_school_courses_header_options',
        'iconset'  => 'fa',
    )
));

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

$wp_customize->add_control(
	'online_school_courses_opening_timing',
	array(
		'label'           => esc_html__( 'Opening Timing', 'online-school-courses' ),
		'section'         => 'online_school_courses_header_options',
		'type'            => 'text',
	)
);

// Header Options - Enable Social Icons.
$wp_customize->add_setting(
	'online_school_courses_enable_header_icon_section',
	array(
		'default'           => true,
		'sanitize_callback' => 'online_school_courses_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Online_School_Courses_Toggle_Switch_Custom_Control(
		$wp_customize,
		'online_school_courses_enable_header_icon_section',
		array(
			'label'    => esc_html__( 'Enable Social', 'online-school-courses' ),
			'section'  => 'online_school_courses_header_options',
			'settings' => 'online_school_courses_enable_header_icon_section',
		)
	)
);

// Add setting for Facebook Link
$wp_customize->add_setting(
	'online_school_courses_header_facebook_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'online_school_courses_header_facebook_link',
	array(
		'label'           => esc_html__( 'Facebook Link', 'online-school-courses'  ),
		'section'         => 'online_school_courses_header_options',
		'settings'        => 'online_school_courses_header_facebook_link',
		'type'      => 'url'
	)
);

// Add setting for Twitter Link
$wp_customize->add_setting(
	'online_school_courses_header_twitter_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'online_school_courses_header_twitter_link',
	array(
		'label'           => esc_html__( 'Twitter Link', 'online-school-courses'  ),
		'section'         => 'online_school_courses_header_options',
		'settings'        => 'online_school_courses_header_twitter_link',
		'type'      => 'url'
	)
);

// Add setting for Linkedin Link
$wp_customize->add_setting(
	'online_school_courses_header_linkedin_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'online_school_courses_header_linkedin_link',
	array(
		'label'           => esc_html__( 'Linkedin Link', 'online-school-courses'  ),
		'section'         => 'online_school_courses_header_options',
		'settings'        => 'online_school_courses_header_linkedin_link',
		'type'      => 'url'
	)
);

// Add setting for Instagram Link
$wp_customize->add_setting(
	'online_school_courses_header_instagram_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'online_school_courses_header_instagram_link',
	array(
		'label'           => esc_html__( 'Instagram Link', 'online-school-courses'  ),
		'section'         => 'online_school_courses_header_options',
		'settings'        => 'online_school_courses_header_instagram_link',
		'type'      => 'url'
	)
);

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

$wp_customize->add_control( new Online_School_Courses_Separator_Custom_Control( $wp_customize, 'online_school_courses_menu_separator', array(
	'label' => __( 'Menu Settings', 'online-school-courses' ),
	'section' => 'online_school_courses_header_options',
	'settings' => 'online_school_courses_menu_separator',
)));

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

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

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

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

$wp_customize->add_setting( 'online_school_courses_menu_text_transform', array(
    'default'           => 'capitalize', // Default value for text transform
    'sanitize_callback' => 'sanitize_text_field',
) );

// Add control for menu text transform
$wp_customize->add_control( 'online_school_courses_menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'online_school_courses_header_options', // Adjust the section as needed
    'label'    => __( 'Menu Text Transform', 'online-school-courses' ),
    'choices'  => array(
        'none'       => __( 'None', 'online-school-courses' ),
        'capitalize' => __( 'Capitalize', 'online-school-courses' ),
        'uppercase'  => __( 'Uppercase', 'online-school-courses' ),
        'lowercase'  => __( 'Lowercase', 'online-school-courses' ),
    ),
) );

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'online_school_courses_menu_text_color', 
		array(
			'label' => __('Menu Color', 'online-school-courses'),
			'section' => 'online_school_courses_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'online_school_courses_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'online-school-courses'),
			'section' => 'online_school_courses_header_options',
		)
	)
);

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

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

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