<?php

/** Header Options Panel */
$wp_customize->add_panel( 'store_expert_header_settings', array(
    'title' => esc_html__( 'Header Settings', 'store-expert' ),
    'description' => esc_html__( 'Configure header settings', 'store-expert' ),
    'priority' => 10,
));

/** Top Header Options */
$wp_customize->add_section( 'store_expert_top_header_options', array(
    'title' => esc_html__( 'Top Header', 'store-expert' ),
    'panel' => 'store_expert_header_settings',
));

$wp_customize->add_setting( 'store_expert_top_header_tabs', array(
    'sanitize_callback' => 'store_expert_text_sanitization',
));

$wp_customize->add_control( new Store_Expert_Tabs_Control( $wp_customize, 'store_expert_top_header_tabs', array(
	/* Make sure you edit the following parameters*/
	'section' => 'store_expert_top_header_options',
	'tabs'    => array(
		'font_family' => array(
			'nicename' => esc_html__( 'Options', 'store-expert' ),
			'icon'     => 'gear',
			'controls' => array(
				'store_expert_top_header_enable',
				'store_expert_top_left_text',
				'store_expert_top_bar_menu_heading',
				'store_expert_top_header_menu_enable',
				'store_expert_top_navigation_menu',
				'store_expert_top_bar_social_heading',
				'store_expert_top_header_social_enable',
				'store_expert_social_icons_repeaters',
				),
			),
		'font_sizes'   => array(
			'nicename' => esc_html__( 'Style', 'store-expert' ),
			'icon'     => 'bars',
			'controls' => array(
				'store_expert_top_header_colour',
				'store_expert_top_header_text_colour',
				),
			),
		),
	)
));

/** Top Header */
$wp_customize->add_setting( 'store_expert_top_header_enable',
	array(
		'default' => 1,
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_switch_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_top_header_enable',
	array(
		'label' => esc_html__( 'Enable Top Bar?', 'store-expert' ),
		'section' => 'store_expert_top_header_options',
		'description' => esc_html__( 'Show or hide Top Bar', 'store-expert' ),
	)
) );

/** Top Header Notice*/
$wp_customize->add_setting( 'store_expert_top_left_text', array(
	'sanitize_callback' => 'store_expert_repeater_sanitize',
));

$wp_customize->add_control( new Store_Expert_Customizer_Repeater( $wp_customize, 'store_expert_top_left_text', array(
	'label'   => esc_html__('Top Left Content','store-expert'),
	'section' => 'store_expert_top_header_options',
	'customizer_repeater_icon_control' => true,
	'customizer_repeater_text_control' => true,
) ) );



/** Top Header Colour*/
$wp_customize->add_setting( 'store_expert_top_header_colour',
	array(
		'default' => '#007bc4',
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_hex_rgba_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Customize_Alpha_Color_Control( $wp_customize, 'store_expert_top_header_colour',
	array(
		'label' => __( 'Background Colour of Top Header', 'store-expert' ),
		'description' => esc_html__( '', 'store-expert' ),
		'section' => 'store_expert_top_header_options',
		'show_opacity' => true, // Optional. Show or hide the opacity value on the opacity slider handle. Default: true
		'palette' => array( // Optional. Select the colours for the colour palette . Default: WP color control palette
			'#007bc4',
			'#4579AE',
			'#0EA7A5',
			'#50C878',
			'#008080',
			'#fa4f26',
			'#1571c1',
			'#8309e7'
		)
	)
) );


/** Top Header Text and Link Colours*/
$wp_customize->add_setting( 'store_expert_top_header_text_colour',
	array(
		'default' => '#FFFFFF',
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_hex_rgba_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Customize_Alpha_Color_Control( $wp_customize, 'store_expert_top_header_text_colour',
	array(
		'label' => __( 'Text and Link Colours', 'store-expert' ),
		'description' => esc_html__( '', 'store-expert' ),
		'section' => 'store_expert_top_header_options',
		'show_opacity' => false, // Optional. Show or hide the opacity value on the opacity slider handle. Default: true
		'palette' => array( // Optional. Select the colours for the colour palette . Default: WP color control palette
			'#000000',
			'#FFFFFF',
			'#333333'
		)
	)
) );

/** Menu Header*/
$wp_customize->add_setting('store_expert_top_bar_menu_heading', array(
    'sanitize_callback' => 'store_expert_text_sanitization',
    'transport' => 'refresh'
));
$wp_customize->add_control(new Store_Expert_Heading($wp_customize, 'store_expert_top_bar_menu_heading', array(
    'section' => 'store_expert_top_header_options',
    'label' => esc_html__('Navigational menu', 'store-expert')
)));

/** Top Header Menu eneble */
$wp_customize->add_setting( 'store_expert_top_header_menu_enable', array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_top_header_menu_enable',array(
	'label' => esc_html__( 'Top Bar menu', 'store-expert' ),
	'section' => 'store_expert_top_header_options',
	'description' => esc_html__( 'Show or hide Top Bar Navigational menu', 'store-expert' ),
)) );

/** Social Links*/
$wp_customize->add_setting('store_expert_top_bar_social_heading', array(
    'sanitize_callback' => 'store_expert_text_sanitization',
    'transport' => 'refresh'
));
$wp_customize->add_control(new Store_Expert_Heading($wp_customize, 'store_expert_top_bar_social_heading', array(
    'section' => 'store_expert_top_header_options',
    'label' => esc_html__('Social Links', 'store-expert')
)));

/** Social eneble */
$wp_customize->add_setting( 'store_expert_top_header_social_enable',array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_top_header_social_enable', array(
	'label' => esc_html__( 'Social Links', 'store-expert' ),
	'section' => 'store_expert_top_header_options',
	'description' => esc_html__( 'Show or hide social links', 'store-expert' ),
)) );


$wp_customize->add_setting( 'store_expert_social_icons_repeaters', array(
	'sanitize_callback' => 'store_expert_repeater_sanitize',
	'default' => json_encode( array(
		/*Repeater's first item*/
		array( "icon_value" => esc_html__( 'fab fa-facebook', 'store-expert' ), "link" => esc_url( 'https://www.facebook.com/', 'store-expert' ) ),
		/*Repeater's second item*/
		array( "icon_value" => esc_html__( 'fab fa-twitter', 'store-expert' ), "link" => esc_url( 'https://www.twitter.com/', 'store-expert' ) ),
		/*Repeater's third item*/
		array( "icon_value" => esc_html__( 'fab fa-vimeo', 'store-expert' ), "link" => esc_url( 'https://www.vimeo.com/', 'store-expert' ) ),
		) ),
));

$wp_customize->add_control( new Store_Expert_Customizer_Repeater( $wp_customize, 'store_expert_social_icons_repeaters', array(
	'label'   => esc_html__('Social Icons','store-expert'),
	'section' => 'store_expert_top_header_options',
	'customizer_repeater_icon_control' => true,
	'customizer_repeater_link_control' => true,
) ) );

/** Middle Header Options */
$wp_customize->add_section( 'store_expert_middle_header_options', array(
    'title' => esc_html__( 'Middle Header', 'store-expert' ),
    'panel' => 'store_expert_header_settings',
));

$wp_customize->add_setting( 'store_expert_middle_header_tabs', array(
    'sanitize_callback' => 'store_expert_text_sanitization',
));

$wp_customize->add_control( new Store_Expert_Tabs_Control( $wp_customize, 'store_expert_middle_header_tabs', array(
	/* Make sure you edit the following parameters*/
	'section' => 'store_expert_middle_header_options',
	'tabs'    => array(
		'font_family' => array(
			'nicename' => esc_html__( 'Options', 'store-expert' ),
			'icon'     => 'gear',
			'controls' => array(
				'store_expert_middle_header_search_enable',
				'store_expert_middle_header_search_options',
				'store_expert_middle_header_wishlist_enable',
				'store_expert_middle_header_cart_enable',
				),
			),
		'font_sizes'   => array(
			'nicename' => esc_html__( 'Style', 'store-expert' ),
			'icon'     => 'bars',
			'controls' => array(
				'store_expert_middle_header_colour',
				'store_expert_middle_header_text_colour',
				'store_expert_middle_header_icon_text_colour',
				),
			),
		),
	)
));

/** middle Header Colour*/
$wp_customize->add_setting( 'store_expert_middle_header_colour',
	array(
		'default' => '#FFFFFF',
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_hex_rgba_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Customize_Alpha_Color_Control( $wp_customize, 'store_expert_middle_header_colour',
	array(
		'label' => __( 'Background Colour of Middle Header', 'store-expert' ),
		'description' => esc_html__( '', 'store-expert' ),
		'section' => 'store_expert_middle_header_options',
		'show_opacity' => true, // Optional. Show or hide the opacity value on the opacity slider handle. Default: true
		'palette' => array( // Optional. Select the colours for the colour palette . Default: WP color control palette
			'#007bc4',
			'#4579AE',
			'#0EA7A5',
			'#50C878',
			'#008080',
			'#fa4f26',
			'#1571c1',
			'#8309e7'
		)
	)
) );

/** Top Header Text and Link Colours*/
$wp_customize->add_setting( 'store_expert_middle_header_text_colour',
	array(
		'default' => '#333333',
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_hex_rgba_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Customize_Alpha_Color_Control( $wp_customize, 'store_expert_middle_header_text_colour',
	array(
		'label' => __( 'Text and Link Colours', 'store-expert' ),
		'description' => esc_html__( '', 'store-expert' ),
		'section' => 'store_expert_middle_header_options',
		'show_opacity' => false, // Optional. Show or hide the opacity value on the opacity slider handle. Default: true
		'palette' => array( // Optional. Select the colours for the colour palette . Default: WP color control palette
			'#000000',
			'#FFFFFF',
			'#333333',
		)
	)
) );

/** Top Header Text and Link Colours*/
$wp_customize->add_setting( 'store_expert_middle_header_icon_text_colour',
	array(
		'default' => '#ffd700',
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_hex_rgba_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Customize_Alpha_Color_Control( $wp_customize, 'store_expert_middle_header_icon_text_colour',
	array(
		'label' => __( 'Cart count background colour', 'store-expert' ),
		'description' => esc_html__( '', 'store-expert' ),
		'section' => 'store_expert_middle_header_options',
		'show_opacity' => false, // Optional. Show or hide the opacity value on the opacity slider handle. Default: true
		'palette' => array( // Optional. Select the colours for the colour palette . Default: WP color control palette
			'#000000'
		)
	)
) );

/** Search box enable */
$wp_customize->add_setting( 'store_expert_middle_header_search_enable',array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_middle_header_search_enable', array(
	'label' => esc_html__( 'Search Bar', 'store-expert' ),
	'section' => 'store_expert_middle_header_options',
	'description' => esc_html__( 'Show or hide search bar', 'store-expert' ),
)) );

/** Search choose */
$wp_customize->add_setting( 'store_expert_middle_header_search_options',array(
	'default' => 'default',
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_text_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Text_Radio_Button_Custom_Control( $wp_customize, 'store_expert_middle_header_search_options',array(
	'label' => __( 'Choose search box', 'store-expert' ),
	'description' => esc_html__( 'Note: Live search requires Advance Product Search plugin activated.', 'store-expert' ),
	'section' => 'store_expert_middle_header_options',
	'choices' => array(
		'live' => __( 'Live Search', 'store-expert' ), 
		'default' => __( 'Default', 'store-expert' ),
	)
)) );

/** Wishlist */
$wp_customize->add_setting( 'store_expert_middle_header_wishlist_enable',array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_middle_header_wishlist_enable', array(
	'label' => esc_html__( 'Wishlist Icon', 'store-expert' ),
	'section' => 'store_expert_middle_header_options',
	'description' => esc_html__( 'Show or hide Wishlist Icon. Note: requires YITH wishlist plugin activated.', 'store-expert' ),
)) );

/** Cart icon */
$wp_customize->add_setting( 'store_expert_middle_header_cart_enable',array(
	'default' => 1,
	'transport' => 'refresh',
	'sanitize_callback' => 'store_expert_switch_sanitization'
));
$wp_customize->add_control( new Store_Expert_Toggle_Switch_Custom_control( $wp_customize, 'store_expert_middle_header_cart_enable', array(
	'label' => esc_html__( 'Cart Icon', 'store-expert' ),
	'section' => 'store_expert_middle_header_options',
	'description' => esc_html__( 'Show or hide Cart Icon', 'store-expert' ),
)) );

/** Navigational menu options */
$wp_customize->add_section( 'store_expert_bottom_header_options', array(
	'title' => esc_html__( 'Main navigational area', 'store-expert' ),
	'panel' => 'store_expert_header_settings',
));
/** Navigational menu tabs */
$wp_customize->add_setting( 'store_expert_bottom_header_tabs', array(
    'sanitize_callback' => 'store_expert_text_sanitization',
));

$wp_customize->add_control( new Store_Expert_Tabs_Control( $wp_customize, 'store_expert_bottom_header_tabs', array(
	/* Make sure you edit the following parameters*/
	'section' => 'store_expert_bottom_header_options',
	'tabs'    => array(
		'font_sizes'   => array(
			'nicename' => esc_html__( 'Style', 'store-expert' ),
			'icon'     => 'bars',
			'controls' => array(
				'store_expert_navigation_header_colour',
				'store_expert_navigation_link_colour',
				'store_expert_navigation_link_hover_colour',
				'store_expert_navigation_link_bg_hover_colour',
				),
			),
		),
	)
));



/** Main navigation background*/
$wp_customize->add_setting( 'store_expert_navigation_header_colour',
	array(
		'default' => '#FFFFFF',
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_hex_rgba_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Customize_Alpha_Color_Control( $wp_customize, 'store_expert_navigation_header_colour',
	array(
		'label' => __( 'Background Colour of Navigation', 'store-expert' ),
		'description' => esc_html__( '', 'store-expert' ),
		'section' => 'store_expert_bottom_header_options',
		'show_opacity' => true, // Optional. Show or hide the opacity value on the opacity slider handle. Default: true
		'palette' => array( // Optional. Select the colours for the colour palette . Default: WP color control palette
			'#007bc4',
			'#4579AE',
			'#0EA7A5',
			'#50C878',
			'#008080',
			'#fa4f26',
			'#1571c1',
			'#ffffff'
		)
	)
) );

/** Main navigation link*/
$wp_customize->add_setting( 'store_expert_navigation_link_colour',
	array(
		'default' => '#333333',
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_hex_rgba_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Customize_Alpha_Color_Control( $wp_customize, 'store_expert_navigation_link_colour',
	array(
		'label' => __( 'Colour of navigation links', 'store-expert' ),
		'description' => esc_html__( '', 'store-expert' ),
		'section' => 'store_expert_bottom_header_options',
		'show_opacity' => true, // Optional. Show or hide the opacity value on the opacity slider handle. Default: true
		'palette' => array( // Optional. Select the colours for the colour palette . Default: WP color control palette
			'#333333',
			'#FFFFFF',
			'#000000',
			'#50C878',
			'#008080',
			'#fa4f26',
			'#1571c1',
			'#ffffff'
		)
	)
) );

/** Main navigation hover color*/
$wp_customize->add_setting( 'store_expert_navigation_link_hover_colour',
	array(
		'default' => '#FFFFFF',
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_hex_rgba_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Customize_Alpha_Color_Control( $wp_customize, 'store_expert_navigation_link_hover_colour',
	array(
		'label' => __( 'Hover colour of navigation links', 'store-expert' ),
		'description' => esc_html__( '', 'store-expert' ),
		'section' => 'store_expert_bottom_header_options',
		'show_opacity' => true, // Optional. Show or hide the opacity value on the opacity slider handle. Default: true
		'palette' => array( // Optional. Select the colours for the colour palette . Default: WP color control palette
			'#333333',
			'#FFFFFF',
			'#000000',
			'#50C878',
			'#008080',
			'#fa4f26',
			'#1571c1',
			'#ffffff'
		)
	)
) );

/** Main navigation hover background color*/
$wp_customize->add_setting( 'store_expert_navigation_link_bg_hover_colour',
	array(
		'default' => '#007bc4',
		'transport' => 'refresh',
		'sanitize_callback' => 'store_expert_hex_rgba_sanitization'
	)
);
$wp_customize->add_control( new Store_Expert_Customize_Alpha_Color_Control( $wp_customize, 'store_expert_navigation_link_bg_hover_colour',
	array(
		'label' => __( 'Hover background of navigation links', 'store-expert' ),
		'description' => esc_html__( '', 'store-expert' ),
		'section' => 'store_expert_bottom_header_options',
		'show_opacity' => true, // Optional. Show or hide the opacity value on the opacity slider handle. Default: true
		'palette' => array( // Optional. Select the colours for the colour palette . Default: WP color control palette
			'#007bc4',
			'#FFFFFF',
			'#000000',
			'#0390a1',
			'#008080',
			'#fa4f26',
			'#1571c1',
			'#ffffff'
		)
	)
) );