<?php
/**
 * Custom A Section
*/
$wp_customize->add_section(new constructionarc_Toggle_Section($wp_customize, 'constructionarc_customa_section', array(
    'title' => esc_html__('Custom Section A', 'construction-arc'),
    'panel' => 'constructionarc_frontpage_settings',
    'priority' => constructionarc_themes_get_section_position('constructionarc_customa_section'),
    'hiding_control' => 'constructionarc_customa_disable'
)));

//ENABLE/DISABLE CUSTOM A SECTION
$wp_customize->add_setting('constructionarc_customa_disable', array(
	'default' => 'disable',
	'transport' => 'postMessage',
	'sanitize_callback' => 'constructionarc_themes_sanitize_switch',    
));
$wp_customize->add_control(new constructionarc_Switch_Control($wp_customize, 'constructionarc_customa_disable', array(
	'label' => esc_html__('Section', 'construction-arc'),
	'section' => 'constructionarc_customa_section',
	'switch_label' => array(
		'enable' => esc_html__('Enable', 'construction-arc'),
		'disable' => esc_html__('Disable', 'construction-arc'),
	),
	'class' => 'switch-section',
    'priority' => -1,
)));

    $wp_customize->add_setting('constructionarc_customa_nav', array(
        'transport' => 'postMessage',
        'sanitize_callback' => 'wp_kses_post',
    ));
    $wp_customize->add_control(new constructionarc_Custom_Control_Tab($wp_customize, 'constructionarc_customa_nav', array(
        'type' => 'tab',
        'section' => 'constructionarc_customa_section',
        'priority' => 1,
        'buttons' => array(
            array(
                'name' => esc_html__('Content', 'construction-arc'),
                'fields' => array(
                    'constructionarc_customa_title_heading',
                    'constructionarc_customa_super_title',
                    'constructionarc_customa_title',
                    'constructionarc_customa_title_align',
                    'constructionarc_customa_title_style',
                    'constructionarc_customa_title_style_heading',
                    'constructionarc_customa_page_settings'
                ),
                'active' => true,
            ),
            array(
                'name' => esc_html__('Style', 'construction-arc'),
                'fields' => array(
                ),
            ),
            array(
                'name' => esc_html__('Advanced', 'construction-arc'),
                'fields' => array(
                    'constructionarc_customa_bg_type',
                    'constructionarc_customa_bg_color',
                    'constructionarc_customa_bg_image',
                    'constructionarc_customa_overlay_color',
                    'constructionarc_customa_padding',
                    'constructionarc_customa_cs_seperator',
                ),
            ),
        ),
    )));

    $wp_customize->add_setting('constructionarc_customa_super_title', array(
        'sanitize_callback' => 'sanitize_text_field',
        'transport' => 'postMessage',
    ));
    $wp_customize->add_control('constructionarc_customa_super_title', array(
        'section' => 'constructionarc_customa_section',
        'type' => 'text',
        'label' => esc_html__('Super Title', 'construction-arc')
    ));

    $wp_customize->add_setting('constructionarc_customa_title', array(
        'sanitize_callback' => 'sanitize_text_field',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control('constructionarc_customa_title', array(
        'section' => 'constructionarc_customa_section',
        'type' => 'text',
        'label' => esc_html__('Title', 'construction-arc')
    ));

    $wp_customize->add_setting('constructionarc_customa_title_align', array(
        'default' => 'text-center',
        'sanitize_callback' => 'constructionarc_themes_sanitize_select',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control(new constructionarc_Custom_Control_Buttonset($wp_customize,'constructionarc_customa_title_align',
        array(
            'choices'  => array(
                'text-left' => esc_html__('Left', 'construction-arc'),
                'text-right' => esc_html__('Right', 'construction-arc'),
                'text-center' => esc_html__('Center', 'construction-arc'),
            ),
            'label'    => esc_html__( 'Alignment', 'construction-arc' ),
            'section'  => 'constructionarc_customa_section',
            'settings' => 'constructionarc_customa_title_align',
        ))
    );


    $wp_customize->add_setting('constructionarc_customa_title_style_heading', array(
        'sanitize_callback' => 'sanitize_text_field',
        'transport' => 'postMessage',
    ));
    $wp_customize->add_control(new constructionarc_Customize_Heading($wp_customize, 'constructionarc_customa_title_style_heading', array(
        'section' => 'constructionarc_customa_section',
        'label' => esc_html__('Section Title Style', 'construction-arc')
    )));

    $wp_customize->add_setting('constructionarc_customa_title_style', array(
        'default' => 'style1',
        'transport' => 'postMessage',
        'sanitize_callback' => 'constructionarc_themes_sanitize_select'         
    ));
    $wp_customize->add_control('constructionarc_customa_title_style', array(
        'section' => 'constructionarc_customa_section',
        'type'    => 'select',
        'choices' => array(
            'style1' => esc_html__('Style 1','construction-arc'),
            'style2' => esc_html__('Style 2','construction-arc'),			
            'style3' => esc_html__('Style 3','construction-arc'),			
        )
    ));

   
    $wp_customize->add_setting('constructionarc_customa_title_heading', array(
        'sanitize_callback' => 'sanitize_text_field',
        'transport' => 'postMessage',
    ));
    $wp_customize->add_control(new constructionarc_Customize_Heading($wp_customize, 'constructionarc_customa_title_heading', array(
        'section' => 'constructionarc_customa_section',
        'label' => esc_html__('Select Section Custom Page', 'construction-arc')
    )));

    $id = "customa";
    $wp_customize->add_setting("constructionarc_{$id}_page_settings", array(
        'transport' => 'postMessage',
        'sanitize_callback' => 'absint',		
    ));
    $wp_customize->add_control( "constructionarc_{$id}_page_settings", array(
        'type'     => 'dropdown-pages',
        'section' 	=> "constructionarc_{$id}_section",
        'description' => esc_html__('Create a custom layout with the selected page using patterns or elementor.', 'construction-arc')
    ));

    $wp_customize->add_setting('constructionarc_pro_customa', array(
        'sanitize_callback' => 'constructionarc_sanitize_text'
    ));
    $wp_customize->add_control(new constructionarc_Themes_Upgrade_Text($wp_customize, 'constructionarc_pro_customa', array(
        'section' => 'constructionarc_customa_section',
        'label' => esc_html__('For More Settings,', 'construction-arc'),
        'choices' => array(
            esc_html__('(5+) Different Section Title Style', 'construction-arc'),
            esc_html__('Title, sub title & text color options', 'construction-arc'),
			esc_html__('4+ Different Background Options( Color/Video/Gradient/Image ) ', 'construction-arc'),
			esc_html__('More Than 35+ Top & Bottom Separator Shape Illustrator with Color & Height Option', 'construction-arc'),
        ),
        'priority' => 250,
    )));

$wp_customize->selective_refresh->add_partial( 'constructionarc_customa_refresh', array (
    'settings' => array( 
        'constructionarc_customa_disable',
        'constructionarc_customa_page_settings',
     ),
    'selector' => '#customa-section',
    'fallback_refresh' => true,
    'container_inclusive' => true,
    'render_callback' => function () {
        return get_template_part( 'section/section', 'customa' );
    }
));