<?php
function expert_ac_repair_sidebar_setting( $wp_customize ) {
$selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh';
	$wp_customize->add_panel(
		'expert_ac_repair_sidebar', array(
			'priority' => 31,
			'title' => esc_html__( 'Sidebar Options', 'expert-ac-repair' ),
		)
	);

	/*=========================================
	Sidebar Option  Section
	=========================================*/
	$wp_customize->add_section(
		'expert_ac_repair_sidebar_settings', array(
			'title' => esc_html__( 'Sidebar Options', 'expert-ac-repair' ),
			'priority' => 1,
			'panel' => 'expert_ac_repair_general',
		)
	);
	

	// Archive Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_ac_repair_archive_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_ac_repair_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_ac_repair_archive_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Archive Sidebar', 'expert-ac-repair' ),
			'section'     => 'expert_ac_repair_sidebar_settings',
			'settings'    => 'expert_ac_repair_archive_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Index Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_ac_repair_index_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_ac_repair_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_ac_repair_index_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Index Sidebar', 'expert-ac-repair' ),
			'section'     => 'expert_ac_repair_sidebar_settings',
			'settings'    => 'expert_ac_repair_index_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Pages Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_ac_repair_paged_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_ac_repair_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_ac_repair_paged_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Pages Sidebar', 'expert-ac-repair' ),
			'section'     => 'expert_ac_repair_sidebar_settings',
			'settings'    => 'expert_ac_repair_paged_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Search Result Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_ac_repair_search_result_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_ac_repair_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_ac_repair_search_result_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Search Result Sidebar', 'expert-ac-repair' ),
			'section'     => 'expert_ac_repair_sidebar_settings',
			'settings'    => 'expert_ac_repair_search_result_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Single Post Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_ac_repair_single_post_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_ac_repair_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_ac_repair_single_post_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Single Post Sidebar', 'expert-ac-repair' ),
			'section'     => 'expert_ac_repair_sidebar_settings',
			'settings'    => 'expert_ac_repair_single_post_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Sidebar Page Sidebar Date Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_ac_repair_single_page_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_ac_repair_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_ac_repair_single_page_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Page Width Sidebar', 'expert-ac-repair' ),
			'section'     => 'expert_ac_repair_sidebar_settings',
			'settings'    => 'expert_ac_repair_single_page_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	$wp_customize->add_setting( 'expert_ac_repair_sidebar_position', array(
        'default'   => 'right',
        'sanitize_callback' => 'expert_ac_repair_sanitize_sidebar_position',
    ));

    $wp_customize->add_control( 'expert_ac_repair_sidebar_position', array(
        'label'    => __( 'Sidebar Position', 'expert-ac-repair' ),
        'section'  => 'expert_ac_repair_sidebar_settings',
        'settings' => 'expert_ac_repair_sidebar_position',
        'type'     => 'radio',
        'choices'  => array(
            'right' => __( 'Right Sidebar', 'expert-ac-repair' ),
            'left'  => __( 'Left Sidebar', 'expert-ac-repair' ),
        ),
    ));

	$wp_customize->add_setting( 'expert_ac_repair_upgrade_page_settings_15',
        array(
            'sanitize_callback' => 'sanitize_text_field'
        )
    );
    $wp_customize->add_control( new Expert_Ac_Repair_Control_Upgrade(
        $wp_customize, 'expert_ac_repair_upgrade_page_settings_15',
            array(
                'priority'      => 200,
                'section'       => 'expert_ac_repair_sidebar_settings',
                'settings'      => 'expert_ac_repair_upgrade_page_settings_15',
                'label'         => __( 'Expert AC Repair Pro comes with additional features.', 'expert-ac-repair' ),
                'choices'       => array( __( '15+ Ready-Made Sections', 'expert-ac-repair' ), __( 'One-Click Demo Import', 'expert-ac-repair' ), __( 'WooCommerce Integrated', 'expert-ac-repair' ), __( 'Drag & Drop Section Reordering', 'expert-ac-repair' ),__( 'Advanced Typography Control', 'expert-ac-repair' ),__( 'Intuitive Customization Options', 'expert-ac-repair' ),__( '24/7 Support', 'expert-ac-repair' ), )
            )
        )
    ); 

}

add_action( 'customize_register', 'expert_ac_repair_sidebar_setting' );