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

$wp_customize->add_section(
	'property_dealer_header_options',
	array(
		'panel' => 'property_dealer_front_page_options',
		'title' => esc_html__( 'Header Options', 'property-dealer' ),
		'priority' => 1,
	)
);

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

// Add control for sticky header setting
$wp_customize->add_control(
	new Property_Dealer_Toggle_Switch_Custom_Control(
		$wp_customize,
		'property_dealer_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Header', 'property-dealer' ),
			'section' => 'property_dealer_header_options',
		)
	)
);

$wp_customize->add_setting(
    'property_dealer_header_location_icon',
    array(
        'default'           => 'fas fa-map-marker-alt',
        'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control(new Property_Dealer_Change_Icon_Control(
    $wp_customize,
    'property_dealer_header_location_icon',
    array(
        'label'   => __('Location Icon','property-dealer'),
        'section' => 'property_dealer_header_options',
        'iconset' => 'fa',
    )
));

$wp_customize->add_setting(
    'property_dealer_location_value',
    array(
        'default'           => '',
        'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control(
    'property_dealer_location_value',
    array(
        'label'   => esc_html__( 'Location', 'property-dealer' ),
        'section' => 'property_dealer_header_options',
        'type'    => 'text',
    )
);

$wp_customize->add_setting(
    'property_dealer_location_text',
    array(
        'default'           => '',
        'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control(
    'property_dealer_location_text',
    array(
        'label'   => esc_html__( 'Location Text', 'property-dealer' ),
        'section' => 'property_dealer_header_options',
        'type'    => 'text',
    )
);

// Contact Section - Phone Icon.
$wp_customize->add_setting(
    'property_dealer_header_phone_icon',
    array(
        'default' => 'fas fa-phone', // Set default icon here
        'sanitize_callback' => 'sanitize_text_field',
        'capability' => 'edit_theme_options',
    )
);

$wp_customize->add_control(new Property_Dealer_Change_Icon_Control(
    $wp_customize, 
    'property_dealer_header_phone_icon',
    array(
        'label'    => __('Phone Icon','property-dealer'),
        'section'  => 'property_dealer_header_options',
        'iconset'  => 'fa',
    )
));

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

$wp_customize->add_control(
	'property_dealer_phone_number',
	array(
		'label'           => esc_html__( 'Phone Number', 'property-dealer' ),
		'section'         => 'property_dealer_header_options',
		'settings'        => 'property_dealer_phone_number',
		'type'            => 'text',
	)
);

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

$wp_customize->add_control(
	'property_dealer_phone_number_text',
	array(
		'label'           => esc_html__( 'Phone Text', 'property-dealer' ),
		'section'         => 'property_dealer_header_options',
		'type'            => 'text',
	)
);

$wp_customize->add_setting(
    'property_dealer_header_time_icon',
    array(
        'default'           => 'fas fa-clock',
        'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control(new Property_Dealer_Change_Icon_Control(
    $wp_customize,
    'property_dealer_header_time_icon',
    array(
        'label'   => __('Time Icon','property-dealer'),
        'section' => 'property_dealer_header_options',
        'iconset' => 'fa',
    )
));

$wp_customize->add_setting(
    'property_dealer_time_value',
    array(
        'default'           => '',
        'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control(
    'property_dealer_time_value',
    array(
        'label'   => esc_html__( 'Time Slot', 'property-dealer' ),
        'section' => 'property_dealer_header_options',
        'type'    => 'text',
    )
);

$wp_customize->add_setting(
    'property_dealer_time_text',
    array(
        'default'           => '',
        'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control(
    'property_dealer_time_text',
    array(
        'label'   => esc_html__( 'Time Text', 'property-dealer' ),
        'section' => 'property_dealer_header_options',
        'type'    => 'text',
    )
);

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

$wp_customize->add_control(
	new Property_Dealer_Toggle_Switch_Custom_Control(
		$wp_customize,
		'property_dealer_enable_header_icon_section',
		array(
			'label'    => esc_html__( 'Enable Social', 'property-dealer' ),
			'section'  => 'property_dealer_header_options',
			'settings' => 'property_dealer_enable_header_icon_section',
		)
	)
);

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

$wp_customize->add_control(
	'property_dealer_header_facebook_link',
	array(
		'label'           => esc_html__( 'Facebook Link', 'property-dealer'  ),
		'section'         => 'property_dealer_header_options',
		'settings'        => 'property_dealer_header_facebook_link',
		'type'      => 'url'
	)
);

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

$wp_customize->add_control(new Property_Dealer_Change_Icon_Control($wp_customize, 
	'property_dealer_header_facebook_icon',
	array(
	    'label'   		=> __('Facebook Icon','property-dealer'),
	    'section' 		=> 'property_dealer_header_options',
		'iconset' => 'fb',
	))  
);

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

$wp_customize->add_control(
	'property_dealer_header_twitter_link',
	array(
		'label'           => esc_html__( 'Twitter Link', 'property-dealer'  ),
		'section'         => 'property_dealer_header_options',
		'settings'        => 'property_dealer_header_twitter_link',
		'type'      => 'url'
	)
);

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

$wp_customize->add_control(new Property_Dealer_Change_Icon_Control($wp_customize, 
	'property_dealer_header_twitter_icon',
	array(
	    'label'   		=> __('Twitter Icon','property-dealer'),
	    'section' 		=> 'property_dealer_header_options',
		'iconset' => 'fb',
	))  
);

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

$wp_customize->add_control(
	'property_dealer_header_linkedin_link',
	array(
		'label'           => esc_html__( 'Linkedin Link', 'property-dealer'  ),
		'section'         => 'property_dealer_header_options',
		'settings'        => 'property_dealer_header_linkedin_link',
		'type'      => 'url'
	)
);

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

$wp_customize->add_control(new Property_Dealer_Change_Icon_Control($wp_customize, 
	'property_dealer_header_linkedin_icon',
	array(
	    'label'   		=> __('Linkedin Icon','property-dealer'),
	    'section' 		=> 'property_dealer_header_options',
		'iconset' => 'fb',
	))  
);

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

$wp_customize->add_control(
	'property_dealer_header_instagram_link',
	array(
		'label'           => esc_html__( 'Instagram Link', 'property-dealer'  ),
		'section'         => 'property_dealer_header_options',
		'settings'        => 'property_dealer_header_instagram_link',
		'type'      => 'url'
	)
);

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

$wp_customize->add_control(new Property_Dealer_Change_Icon_Control($wp_customize, 
	'property_dealer_header_instagram_icon',
	array(
	    'label'   		=> __('Instagram Icon','property-dealer'),
	    'section' 		=> 'property_dealer_header_options',
		'iconset' => 'fb',
	))  
);

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

$wp_customize->add_control( new Property_Dealer_Separator_Custom_Control( $wp_customize, 'property_dealer_menu_separator', array(
	'label' => __( 'Menu Settings', 'property-dealer' ),
	'section' => 'property_dealer_header_options',
	'settings' => 'property_dealer_menu_separator',
)));

$wp_customize->add_setting( 'property_dealer_menu_font_size', array(
    'default'           => 16,
    'sanitize_callback' => 'absint',
));

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

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

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

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

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'property_dealer_menu_text_color', 
		array(
			'label' => __('Menu Color', 'property-dealer'),
			'section' => 'property_dealer_header_options',
		)
	)
);

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

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'property_dealer_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'property-dealer'),
			'section' => 'property_dealer_header_options',
		)
	)
);

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

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

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