<?php
function solar_system_company_sidebar_setting( $wp_customize ) {
$selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh';
	$wp_customize->add_panel(
		'solar_system_company_sidebar', array(
			'priority' => 31,
			'title' => esc_html__( 'Sidebar Options', 'solar-system-company' ),
		)
	);

	/*=========================================
	Sidebar Option  Section
	=========================================*/
	$wp_customize->add_section(
		'solar_system_company_sidebar_settings', array(
			'title' => esc_html__( 'Sidebar Options', 'solar-system-company' ),
			'priority' => 1,
			'panel' => 'solar_system_company_general',
		)
	);
	

	// Archive Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'solar_system_company_archive_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'solar_system_company_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'solar_system_company_archive_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Archive Sidebar', 'solar-system-company' ),
			'section'     => 'solar_system_company_sidebar_settings',
			'settings'    => 'solar_system_company_archive_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Index Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'solar_system_company_index_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'solar_system_company_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'solar_system_company_index_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Index Sidebar', 'solar-system-company' ),
			'section'     => 'solar_system_company_sidebar_settings',
			'settings'    => 'solar_system_company_index_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Pages Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'solar_system_company_paged_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'solar_system_company_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'solar_system_company_paged_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Pages Sidebar', 'solar-system-company' ),
			'section'     => 'solar_system_company_sidebar_settings',
			'settings'    => 'solar_system_company_paged_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Search Result Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'solar_system_company_search_result_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'solar_system_company_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'solar_system_company_search_result_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Search Result Sidebar', 'solar-system-company' ),
			'section'     => 'solar_system_company_sidebar_settings',
			'settings'    => 'solar_system_company_search_result_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Single Post Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'solar_system_company_single_post_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'solar_system_company_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'solar_system_company_single_post_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Single Post Sidebar', 'solar-system-company' ),
			'section'     => 'solar_system_company_sidebar_settings',
			'settings'    => 'solar_system_company_single_post_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Sidebar Page Sidebar Date Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'solar_system_company_single_page_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'solar_system_company_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'solar_system_company_single_page_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Page Width Sidebar', 'solar-system-company' ),
			'section'     => 'solar_system_company_sidebar_settings',
			'settings'    => 'solar_system_company_single_page_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	$wp_customize->add_setting( 'solar_system_company_sidebar_position', array(
        'default'   => 'right',
        'sanitize_callback' => 'solar_system_company_sanitize_sidebar_position',
    ));

    $wp_customize->add_control( 'solar_system_company_sidebar_position', array(
        'label'    => __( 'Sidebar Position', 'solar-system-company' ),
        'section'  => 'solar_system_company_sidebar_settings',
        'settings' => 'solar_system_company_sidebar_position',
        'type'     => 'radio',
        'choices'  => array(
            'right' => __( 'Right Sidebar', 'solar-system-company' ),
            'left'  => __( 'Left Sidebar', 'solar-system-company' ),
        ),
    ));

	 $wp_customize->add_setting( 'solar_system_company_upgrade_page_settings_15',
        array(
            'sanitize_callback' => 'sanitize_text_field'
        )
    );
    $wp_customize->add_control( new Solar_System_Company_Control_Upgrade(
        $wp_customize, 'solar_system_company_upgrade_page_settings_15',
            array(
                'priority'      => 200,
                'section'       => 'solar_system_company_sidebar_settings',
                'settings'      => 'solar_system_company_upgrade_page_settings_15',
                'label'         => __( 'Solar System Company Pro comes with additional features.', 'solar-system-company' ),
                'choices'       => array( __( '15+ Ready-Made Sections', 'solar-system-company' ), __( 'One-Click Demo Import', 'solar-system-company' ), __( 'WooCommerce Integrated', 'solar-system-company' ), __( 'Drag & Drop Section Reordering', 'solar-system-company' ),__( 'Advanced Typography Control', 'solar-system-company' ),__( 'Intuitive Customization Options', 'solar-system-company' ),__( '24/7 Support', 'solar-system-company' ), )
            )
        )
    ); 
}

add_action( 'customize_register', 'solar_system_company_sidebar_setting' );