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

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

$wp_customize->add_section(
	'handmade_craft_header_options',
	array(
		'panel' => 'handmade_craft_front_page_options',
		'title' => esc_html__( 'Header Options', 'handmade-craft' ),
        'priority' => 1,
	)
);

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

$wp_customize->add_control(
	new Handmade_Craft_Toggle_Switch_Custom_Control(
		$wp_customize,
		'handmade_craft_enable_topbar',
		array(
			'label'    => esc_html__( 'Enable Topbar', 'handmade-craft' ),
			'section'  => 'handmade_craft_header_options',
			'settings' => 'handmade_craft_enable_topbar',
		)
	)
);

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

// Add control for sticky header setting
$wp_customize->add_control(
	new Handmade_Craft_Toggle_Switch_Custom_Control(
		$wp_customize,
		'handmade_craft_enable_header_search_section',
		array(
			'label'   => esc_html__( 'Enable Search', 'handmade-craft' ),
			'section' => 'handmade_craft_header_options',
		)
	)
);

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

$wp_customize->add_control(
	'handmade_craft_discount_topbar_text',
	array(
		'label'           => esc_html__( 'Topbar Discount Text', 'handmade-craft' ),
		'section'         => 'handmade_craft_header_options',
		'type'            => 'text',
		'active_callback' => 'handmade_craft_is_topbar_enabled',
	)
);




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

$wp_customize->add_control(
	'handmade_craft_location_view_button_text',
	array(
		'label'           => esc_html__( 'Location Text', 'handmade-craft' ),
		'section'         => 'handmade_craft_header_options',
		'type'            => 'text',
		'active_callback' => 'handmade_craft_is_topbar_enabled',
	)
);

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

$wp_customize->add_control(
	'handmade_craft_location_view_button_url',
	array(
		'label'           => esc_html__( 'Location URL', 'handmade-craft' ),
		'section'         => 'handmade_craft_header_options',
		'type'            => 'text',
		'active_callback' => 'handmade_craft_is_topbar_enabled',
	)
);



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

$wp_customize->add_control(
	'handmade_craft_order_view_button_text',
	array(
		'label'           => esc_html__( 'Order Text', 'handmade-craft' ),
		'section'         => 'handmade_craft_header_options',
		'type'            => 'text',
		'active_callback' => 'handmade_craft_is_topbar_enabled',
	)
);

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

$wp_customize->add_control(
	'handmade_craft_order_view_button_url',
	array(
		'label'           => esc_html__( 'Order URL', 'handmade-craft' ),
		'section'         => 'handmade_craft_header_options',
		'type'            => 'text',
		'active_callback' => 'handmade_craft_is_topbar_enabled',
	)
);



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

$wp_customize->add_control( new Handmade_Craft_Separator_Custom_Control( $wp_customize, 'handmade_craft_menu_separator', array(
	'label' => __( 'Menu Settings', 'handmade-craft' ),
	'section' => 'handmade_craft_header_options',
	'settings' => 'handmade_craft_menu_separator',
)));

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

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

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

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

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

// Add control for menu text transform
$wp_customize->add_control( 'handmade_craft_menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'handmade_craft_header_options', // Adjust the section as needed
    'label'    => __( 'Menu Text Transform', 'handmade-craft' ),
    'choices'  => array(
        'none'       => __( 'None', 'handmade-craft' ),
        'capitalize' => __( 'Capitalize', 'handmade-craft' ),
        'uppercase'  => __( 'Uppercase', 'handmade-craft' ),
        'lowercase'  => __( 'Lowercase', 'handmade-craft' ),
    ),
) );

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'handmade_craft_menu_text_color', 
		array(
			'label' => __('Menu Color', 'handmade-craft'),
			'section' => 'handmade_craft_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'handmade_craft_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'handmade-craft'),
			'section' => 'handmade_craft_header_options',
		)
	)
);

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