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

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

$wp_customize->add_section(
	'jewelry_accessories_header_options',
	array(
		'panel' => 'jewelry_accessories_front_page_options',
		'title' => esc_html__( 'Header Options', 'jewelry-accessories' ),
        'priority' => 1,
	)
);


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

// Add control for sticky header setting
$wp_customize->add_control(
	new Jewelry_Accessories_Toggle_Switch_Custom_Control(
		$wp_customize,
		'jewelry_accessories_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Header', 'jewelry-accessories' ),
			'section' => 'jewelry_accessories_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new Jewelry_Accessories_Toggle_Switch_Custom_Control(
		$wp_customize,
		'jewelry_accessories_enable_topbar',
		array(
			'label'    => esc_html__( 'Enable Topbar', 'jewelry-accessories' ),
			'section'  => 'jewelry_accessories_header_options',
			'settings' => 'jewelry_accessories_enable_topbar',
		)
	)
);

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

// Add control for sticky header setting
$wp_customize->add_control(
	new Jewelry_Accessories_Toggle_Switch_Custom_Control(
		$wp_customize,
		'jewelry_accessories_enable_header_search_section',
		array(
			'label'   => esc_html__( 'Enable Search', 'jewelry-accessories' ),
			'section' => 'jewelry_accessories_header_options',
		)
	)
);

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

$wp_customize->add_control(
	'jewelry_accessories_discount_topbar_text',
	array(
		'label'           => esc_html__( 'Topbar Discount Text', 'jewelry-accessories' ),
		'section'         => 'jewelry_accessories_header_options',
		'type'            => 'text',
		'active_callback' => 'jewelry_accessories_is_topbar_enabled',
	)
);

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

$wp_customize->add_control( new Jewelry_Accessories_Separator_Custom_Control( $wp_customize, 'jewelry_accessories_menu_separator', array(
	'label' => __( 'Menu Settings', 'jewelry-accessories' ),
	'section' => 'jewelry_accessories_header_options',
	'settings' => 'jewelry_accessories_menu_separator',
)));

$wp_customize->add_setting( 'jewelry_accessories_menu_font_size', array(
    'default'           => 14,
    'sanitize_callback' => 'absint',
));

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

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

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

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

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'jewelry_accessories_menu_text_color', 
		array(
			'label' => __('Menu Color', 'jewelry-accessories'),
			'section' => 'jewelry_accessories_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'jewelry_accessories_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'jewelry-accessories'),
			'section' => 'jewelry_accessories_header_options',
		)
	)
);

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

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

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