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

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

$wp_customize->add_section(
	'aster_travel_blog_header_options',
	array(
		'panel' => 'aster_travel_blog_front_page_options',
		'title' => esc_html__( 'Header Options', 'aster-travel-blog' ),
        'priority' => 1,
	)
);

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

// Add control for sticky header setting
$wp_customize->add_control(
	new Aster_Travel_Blog_Toggle_Switch_Custom_Control(
		$wp_customize,
		'aster_travel_blog_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Menu', 'aster-travel-blog' ),
			'section' => 'aster_travel_blog_header_options',
		)
	)
);

// Header Options - Enable Topbar.
$wp_customize->add_setting(
	'aster_travel_blog_enable_topbar',
	array(
		'sanitize_callback' => 'aster_travel_blog_sanitize_switch',
		'default'           => false,
	)
);

$wp_customize->add_control(
	new Aster_Travel_Blog_Toggle_Switch_Custom_Control(
		$wp_customize,
		'aster_travel_blog_enable_topbar',
		array(
			'label'   => esc_html__( 'Enable Topbar', 'aster-travel-blog' ),
			'section' => 'aster_travel_blog_header_options',
		)
	)
);

// Header Options - Welcome Text.
$wp_customize->add_setting(
	'aster_travel_blog_welcome_topbar_text',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'aster_travel_blog_welcome_topbar_text',
	array(
		'label'           => esc_html__( 'Topbar Text', 'aster-travel-blog' ),
		'section'         => 'aster_travel_blog_header_options',
		'type'            => 'text',
		'active_callback' => 'aster_travel_blog_is_topbar_enabled',
	)
);

$wp_customize->add_setting(
	'aster_travel_blog_account_icon',
	array(
		'default'	=> 'far fa-user',
		'sanitize_callback'	=> 'sanitize_text_field',
		'capability' => 'edit_theme_options',
	)
);

$wp_customize->add_control(new Aster_Travel_Blog_Change_Icon_Control($wp_customize,
	'aster_travel_blog_account_icon',
	array(
		'label'	=> __('Account Icon','aster-travel-blog'),
		'section'	=> 'aster_travel_blog_header_options',
		'iconset' => 'fa',
		'active_callback' => 'aster_travel_blog_is_topbar_enabled',
	)
));

$wp_customize->add_setting(
	'aster_travel_blog_account_button_link',
	array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	)
);
$wp_customize->add_control(
	'aster_travel_blog_account_button_link',
	array(
		'label'	=> __('Account Link','aster-travel-blog'),
		'section'	=> 'aster_travel_blog_header_options',
		'setting'	=> 'aster_travel_blog_account_button_link',
		'type'	=> 'url',
		'active_callback' => 'aster_travel_blog_is_topbar_enabled',
	)
);

$wp_customize->add_setting(
	'aster_travel_blog_wishlist_icon',
	array(
		'default'	=> 'far fa-heart',
		'sanitize_callback'	=> 'sanitize_text_field',
		'capability' => 'edit_theme_options',
	)
);

$wp_customize->add_control(new Aster_Travel_Blog_Change_Icon_Control($wp_customize,
	'aster_travel_blog_wishlist_icon',
	array(
		'label'	=> __('Wishlist Icon','aster-travel-blog'),
		'section'	=> 'aster_travel_blog_header_options',
		'iconset' => 'fa',
		'active_callback' => 'aster_travel_blog_is_topbar_enabled',
	)
));

$wp_customize->add_setting(
	'aster_travel_blog_wishlist_button_link',
	array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	)
);
$wp_customize->add_control(
	'aster_travel_blog_wishlist_button_link',
	array(
		'label'	=> __('Wishlist Link','aster-travel-blog'),
		'section'	=> 'aster_travel_blog_header_options',
		'setting'	=> 'aster_travel_blog_wishlist_button_link',
		'type'	=> 'url',
		'active_callback' => 'aster_travel_blog_is_topbar_enabled',
	)
);

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

$wp_customize->add_control( new Aster_Travel_Blog_Separator_Custom_Control( $wp_customize, 'aster_travel_blog_menu_separator', array(
	'label' => __( 'Menu Settings', 'aster-travel-blog' ),
	'section' => 'aster_travel_blog_header_options',
	'settings' => 'aster_travel_blog_menu_separator',
)));

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

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

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

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

// Add setting for menu text transform
$wp_customize->add_setting('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('menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'aster_travel_blog_header_options', // Section where the control will appear
    'label'    => __('Menu Text Transform', 'aster-travel-blog'),
    'choices'  => array(
        'none'       => __('None', 'aster-travel-blog'),
        'capitalize' => __('Capitalize', 'aster-travel-blog'),
        'uppercase'  => __('Uppercase', 'aster-travel-blog'),
        'lowercase'  => __('Lowercase', 'aster-travel-blog'),
    ),
));


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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'aster_travel_blog_menu_text_color', 
		array(
			'label' => __('Menu Color', 'aster-travel-blog'),
			'section' => 'aster_travel_blog_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'aster_travel_blog_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'aster-travel-blog'),
			'section' => 'aster_travel_blog_header_options',
		)
	)
);

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

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