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

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

$wp_customize->add_section(
	'retailer_bookstore_header_options',
	array(
		'panel' => 'retailer_bookstore_front_page_options',
		'title' => esc_html__( 'Header Options', 'retailer-bookstore' ),
        'priority' => 1,
	)
);

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

// Add control for sticky header setting
$wp_customize->add_control(
	new Retailer_Bookstore_Toggle_Switch_Custom_Control(
		$wp_customize,
		'retailer_bookstore_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Header', 'retailer-bookstore' ),
			'section' => 'retailer_bookstore_header_options',
		)
	)
);

// Banner Section - Enable Section.
$wp_customize->add_setting(
	'retailer_bookstore_enable_header_search_section',
	array(
		'default'           => true,
		'sanitize_callback' => 'retailer_bookstore_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Retailer_Bookstore_Toggle_Switch_Custom_Control(
		$wp_customize,
		'retailer_bookstore_enable_header_search_section',
		array(
			'label'    => esc_html__( 'Enable Search Section', 'retailer-bookstore' ),
			'section'  => 'retailer_bookstore_header_options',
			'settings' => 'retailer_bookstore_enable_header_search_section',
		)
	)
);

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

$wp_customize->add_control(
	'retailer_bookstore_header_button_label_',
	array(
		'label'           => esc_html__( 'Button Label 1', 'retailer-bookstore'  ),
		'section'         => 'retailer_bookstore_header_options',
		'settings'        => 'retailer_bookstore_header_button_label_',
		'type'            => 'text',
	)
);

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

$wp_customize->add_control(
	'retailer_bookstore_header_button_link_',
	array(
		'label'           => esc_html__( 'Button Link 1', 'retailer-bookstore' ),
		'section'         => 'retailer_bookstore_header_options',
		'settings'        => 'retailer_bookstore_header_button_link_',
		'type'            => 'url',
	)
);

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

$wp_customize->add_control(
	'retailer_bookstore_header_button_label_1',
	array(
		'label'           => esc_html__( 'Button Label 2', 'retailer-bookstore'  ),
		'section'         => 'retailer_bookstore_header_options',
		'settings'        => 'retailer_bookstore_header_button_label_1',
		'type'            => 'text',
	)
);

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

$wp_customize->add_control(
	'retailer_bookstore_header_button_link_1',
	array(
		'label'           => esc_html__( 'Button Link 2', 'retailer-bookstore' ),
		'section'         => 'retailer_bookstore_header_options',
		'settings'        => 'retailer_bookstore_header_button_link_1',
		'type'            => 'url',
	)
);

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

$wp_customize->add_control( new Retailer_Bookstore_Separator_Custom_Control( $wp_customize, 'retailer_bookstore_menu_separator', array(
	'label' => __( 'Menu Settings', 'retailer-bookstore' ),
	'section' => 'retailer_bookstore_header_options',
	'settings' => 'retailer_bookstore_menu_separator',
)));

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

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

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

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

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

$wp_customize->add_control( 'retailer_bookstore_menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'retailer_bookstore_header_options',
    'label'    => __( 'Menu Text Transform', 'retailer-bookstore' ),
    'choices'  => array(
        'none'       => __( 'None', 'retailer-bookstore' ),
        'capitalize' => __( 'Capitalize', 'retailer-bookstore' ),
        'uppercase'  => __( 'Uppercase', 'retailer-bookstore' ),
        'lowercase'  => __( 'Lowercase', 'retailer-bookstore' ),
    ),
) );


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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'retailer_bookstore_menu_text_color', 
		array(
			'label' => __('Menu Color', 'retailer-bookstore'),
			'section' => 'retailer_bookstore_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'retailer_bookstore_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'retailer-bookstore'),
			'section' => 'retailer_bookstore_header_options',
		)
	)
);

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

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