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

$wp_customize->add_section(
	'jeweler_shop_header_options',
	array(
		'panel' => 'jeweler_shop_front_page_options',
		'title' => esc_html__( 'Header Options', 'jeweler-shop' ),
		'priority' => 1,
	)
);


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

// Add control for sticky header setting
$wp_customize->add_control(
	new Jeweler_Shop_Toggle_Switch_Custom_Control(
		$wp_customize,
		'jeweler_shop_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Header', 'jeweler-shop' ),
			'section' => 'jeweler_shop_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new Jeweler_Shop_Toggle_Switch_Custom_Control(
		$wp_customize,
		'jeweler_shop_enable_topbar',
		array(
			'label'    => esc_html__( 'Enable Topbar', 'jeweler-shop' ),
			'section'  => 'jeweler_shop_header_options',
			'settings' => 'jeweler_shop_enable_topbar',
		)
	)
);

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

// Add control for sticky header setting
$wp_customize->add_control(
	new Jeweler_Shop_Toggle_Switch_Custom_Control(
		$wp_customize,
		'jeweler_shop_enable_header_search_section',
		array(
			'label'   => esc_html__( 'Enable Search', 'jeweler-shop' ),
			'section' => 'jeweler_shop_header_options',
		)
	)
);

// Contact Section - Phone Icon.
$wp_customize->add_setting(
    'jeweler_shop_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 Jeweler_Shop_Change_Icon_Control(
    $wp_customize, 
    'jeweler_shop_header_phone_icon',
    array(
        'label'    => __('Phone Icon','jeweler-shop'),
        'section'  => 'jeweler_shop_header_options',
        'iconset'  => 'fa',
    )
));

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

$wp_customize->add_control(
	'jeweler_shop_phone_number',
	array(
		'label'           => esc_html__( 'Phone Number', 'jeweler-shop' ),
		'section'         => 'jeweler_shop_header_options',
		'settings'        => 'jeweler_shop_phone_number',
		'type'            => 'text',
	)
);


// Header Options 
$wp_customize->add_setting(
	'jeweler_shop_discount_topbar_text',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'jeweler_shop_discount_topbar_text',
	array(
		'label'           => esc_html__( 'Topbar Discount Text', 'jeweler-shop' ),
		'section'         => 'jeweler_shop_header_options',
		'type'            => 'text',
		'active_callback' => 'jeweler_shop_is_topbar_enabled',
	)
);

// Header Options - Enable Social Icons.
$wp_customize->add_setting(
	'jeweler_shop_enable_header_icon_section',
	array(
		'default'           => false,
		'sanitize_callback' => 'jeweler_shop_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Jeweler_Shop_Toggle_Switch_Custom_Control(
		$wp_customize,
		'jeweler_shop_enable_header_icon_section',
		array(
			'label'    => esc_html__( 'Enable Social', 'jeweler-shop' ),
			'section'  => 'jeweler_shop_header_options',
			'settings' => 'jeweler_shop_enable_header_icon_section',
		)
	)
);

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

$wp_customize->add_control(
	'jeweler_shop_header_facebook_link',
	array(
		'label'           => esc_html__( 'Facebook Link', 'jeweler-shop'  ),
		'section'         => 'jeweler_shop_header_options',
		'settings'        => 'jeweler_shop_header_facebook_link',
		'type'      => 'url'
	)
);

// Add setting for Facebook Icon Changing
$wp_customize->add_setting(
	'jeweler_shop_header_facebook_icon',
	array(
        'default' => 'fab fa-facebook-f',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
		
	)
);	

$wp_customize->add_control(new Jeweler_Shop_Change_Icon_Control($wp_customize, 
	'jeweler_shop_header_facebook_icon',
	array(
	    'label'   		=> __('Facebook Icon','jeweler-shop'),
	    'section' 		=> 'jeweler_shop_header_options',
		'iconset' => 'fb',
	))  
);


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

$wp_customize->add_control(
	'jeweler_shop_header_pinterest_link',
	array(
		'label'           => esc_html__( 'Pinterest Link', 'jeweler-shop'  ),
		'section'         => 'jeweler_shop_header_options',
		'settings'        => 'jeweler_shop_header_pinterest_link',
		'type'      => 'url'
	)
);

// Add setting for Pinterest Icon Changing
$wp_customize->add_setting(
	'jeweler_shop_header_pinterest_icon',
	array(
        'default' => 'fab fa-pinterest',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
		
	)
);	

$wp_customize->add_control(new Jeweler_Shop_Change_Icon_Control($wp_customize, 
	'jeweler_shop_header_pinterest_icon',
	array(
	    'label'   		=> __('Pinterest Icon','jeweler-shop'),
	    'section' 		=> 'jeweler_shop_header_options',
		'iconset' => 'fb',
	))  
);

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

$wp_customize->add_control(
	'jeweler_shop_header_instagram_link',
	array(
		'label'           => esc_html__( 'Instagram Link', 'jeweler-shop'  ),
		'section'         => 'jeweler_shop_header_options',
		'settings'        => 'jeweler_shop_header_instagram_link',
		'type'      => 'url'
	)
);

// Add setting for Instagram Icon Changing
$wp_customize->add_setting(
	'jeweler_shop_header_instagram_icon',
	array(
        'default' => 'fab fa-instagram',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
		
	)
);	

$wp_customize->add_control(new Jeweler_Shop_Change_Icon_Control($wp_customize, 
	'jeweler_shop_header_instagram_icon',
	array(
	    'label'   		=> __('Instagram Icon','jeweler-shop'),
	    'section' 		=> 'jeweler_shop_header_options',
		'iconset' => 'fb',
	))  
);

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

$wp_customize->add_control(
	'jeweler_shop_header_youtube_link',
	array(
		'label'           => esc_html__( 'Youtube Link', 'jeweler-shop'  ),
		'section'         => 'jeweler_shop_header_options',
		'settings'        => 'jeweler_shop_header_youtube_link',
		'type'      => 'url'
	)
);

// Add setting for Youtube Icon Changing
$wp_customize->add_setting(
	'jeweler_shop_header_youtube_icon',
	array(
        'default' => 'fab fa-youtube',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
		
	)
);	

$wp_customize->add_control(new Jeweler_Shop_Change_Icon_Control($wp_customize, 
	'jeweler_shop_header_youtube_icon',
	array(
	    'label'   		=> __('Youtube Icon','jeweler-shop'),
	    'section' 		=> 'jeweler_shop_header_options',
		'iconset' => 'fb',
	))  
);

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

$wp_customize->add_control(
	'jeweler_shop_header_whatsapp_link',
	array(
		'label'           => esc_html__( 'Whatsapp Link', 'jeweler-shop'  ),
		'section'         => 'jeweler_shop_header_options',
		'settings'        => 'jeweler_shop_header_whatsapp_link',
		'type'      => 'url'
	)
);

// Add setting for Whatsapp Icon Changing
$wp_customize->add_setting(
	'jeweler_shop_header_whatsapp_icon',
	array(
        'default' => 'fab fa-whatsapp',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
		
	)
);	

$wp_customize->add_control(new Jeweler_Shop_Change_Icon_Control($wp_customize, 
	'jeweler_shop_header_whatsapp_icon',
	array(
	    'label'   		=> __('Whatsapp Icon','jeweler-shop'),
	    'section' 		=> 'jeweler_shop_header_options',
		'iconset' => 'fb',
	))  
);

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

$wp_customize->add_control(
	'jeweler_shop_topheader_button_text',
	array(
		'label'           => esc_html__( 'Button Label', 'jeweler-shop'  ),
		'section'         => 'jeweler_shop_header_options',
		'settings'        => 'jeweler_shop_topheader_button_text',
		'type'            => 'text',
	)
);

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

$wp_customize->add_control(
	'jeweler_shop_topheader_button_url',
	array(
		'label'           => esc_html__( 'Button Link', 'jeweler-shop' ),
		'section'         => 'jeweler_shop_header_options',
		'settings'        => 'jeweler_shop_topheader_button_url',
		'type'            => 'url',
	)
);

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

$wp_customize->add_control( new Jeweler_Shop_Separator_Custom_Control( $wp_customize, 'jeweler_shop_menu_separator', array(
	'label' => __( 'Menu Settings', 'jeweler-shop' ),
	'section' => 'jeweler_shop_header_options',
	'settings' => 'jeweler_shop_menu_separator',
)));

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

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

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

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

$wp_customize->add_setting( 'jeweler_shop_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( 'jeweler_shop_menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'jeweler_shop_header_options', // Adjust the section as needed
    'label'    => __( 'Menu Text Transform', 'jeweler-shop' ),
    'choices'  => array(
        'none'       => __( 'None', 'jeweler-shop' ),
        'capitalize' => __( 'Capitalize', 'jeweler-shop' ),
        'uppercase'  => __( 'Uppercase', 'jeweler-shop' ),
        'lowercase'  => __( 'Lowercase', 'jeweler-shop' ),
    ),
) );

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'jeweler_shop_menu_text_color', 
		array(
			'label' => __('Menu Color', 'jeweler-shop'),
			'section' => 'jeweler_shop_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'jeweler_shop_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'jeweler-shop'),
			'section' => 'jeweler_shop_header_options',
		)
	)
);

// Topbar Padding Setting
$wp_customize->add_setting('jeweler_shop_topbar_padding',array(
		'default' => '',
		'sanitize_callback' => 'absint'
	)
);
$wp_customize->add_control('jeweler_shop_topbar_padding',array(
		'label' => __('Topbar Padding','jeweler-shop'),
		'section' => 'jeweler_shop_header_options',
		'type' => 'number',
		'input_attrs' => array(
			'min' => 0,
			'max' => 50,
			'step' => 1
		)
	)
);

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

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