<?php

$wp_customize->add_section('constructionarc_footer_section', array(
    'title'		  => esc_html__('Footer Settings','construction-arc'),
    'priority'	  => 66,
));

$wp_customize->add_setting('constructionarc_footer_nav', array(
    'transport' => 'postMessage',
    'sanitize_callback' => 'wp_kses_post',
    'priority' => -1,
));
$wp_customize->add_control(new constructionarc_Custom_Control_Tab($wp_customize, 'constructionarc_footer_nav', array(
    'type' => 'tab',
    'section' => 'constructionarc_footer_section',
    'buttons' => array(
        array(
            'name' => esc_html__('Settings', 'construction-arc'),
            'fields' => array(
                'constructionarc_footer_column',
            ),
            'active' => true,
        ),
        array(
            'name' => esc_html__('Style', 'construction-arc'),
            'fields' => array(
            )
        ),
        array(
            'name' => esc_html__('Advanced', 'construction-arc'),
            'fields' => array(
                'constructionarc_footer_bg_heading',
                'constructionarc_footer_bg_type',
                'constructionarc_footer_bg_color',
                'constructionarc_footer_background_image',
                'constructionarc_footer_bg_image',
                'constructionarc_footer_overlay_color',
                'constructionarc_footer_padding',
                'constructionarc_footer_bottom_seperator',
                'constructionarc_footer_seperator0',
                'constructionarc_footer_section_seperator',
                'constructionarc_footer_top_seperator',
                'constructionarc_footer_ts_color',
                'constructionarc_footer_ts_height',
            )
        )
    )
)));

$wp_customize->add_setting('constructionarc_footer_column', array(
    'sanitize_callback' => 'constructionarc_themes_sanitize_text',
    'default' => 'd-grid-column-3',
    'transport' => 'postMessage',
));
$imagepath =  get_template_directory_uri() . '/inc/customizer/images/';
$wp_customize->add_control(new constructionarc_Selector($wp_customize, 'constructionarc_footer_column', array(
    'section' => 'constructionarc_footer_section',
    'label' => esc_html__('Choose Layout', 'construction-arc'),
    'options' => array(
        'd-grid-column-1' => $imagepath . 'footer-style1.webp',
        'd-grid-column-2' => $imagepath . 'footer-style2.webp',
        'd-grid-column-3' => $imagepath . 'footer-style3.webp',
        'd-grid-column-4' => $imagepath . 'footer-style6.webp'
    )
)));

    $id = "footer";
    $wp_customize->add_setting("constructionarc_{$id}_bg_type", array(
        'default' => 'none',
        'sanitize_callback' => 'constructionarc_themes_sanitize_select',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control("constructionarc_{$id}_bg_type", array(
        'section' => "constructionarc_{$id}_section",
        'type' => 'select',
        'label' => esc_html__('Background Type', 'construction-arc'),
        'choices' => array(
            'none'      => esc_html__('Default', 'construction-arc'),
            'color-bg'  => esc_html__('Color Background', 'construction-arc'),
            'image-bg' => esc_html__('Image Background', 'construction-arc'),
        )
    ));

    $wp_customize->add_setting("constructionarc_{$id}_bg_color", array(
        'default' => '',
        'sanitize_callback' => 'constructionarc_themes_sanitize_color_alpha',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control(new constructionarc_Alpha_Color_Control($wp_customize, "constructionarc_{$id}_bg_color", array(
        'section' => "constructionarc_{$id}_section",
        'label' => esc_html__('Background Color', 'construction-arc'),
    )));

    $wp_customize->add_setting("constructionarc_{$id}_bg_image_url", array(
        'sanitize_callback' => 'esc_url_raw',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control(new constructionarc_Background_Control($wp_customize, "constructionarc_{$id}_bg_image", array(
        'label' => esc_html__('Background Image', 'construction-arc'),
        'section' => "constructionarc_{$id}_section",
        'settings' => array(
            'image_url' => "constructionarc_{$id}_bg_image_url",
        )
    )));

    $wp_customize->add_setting('constructionarc_footer_overlay_color', array(
        'sanitize_callback' => 'constructionarc_themes_sanitize_color_alpha',
        'transport' => 'postMessage',
        'default' => ''
    ));
    $wp_customize->add_control(new constructionarc_Alpha_Color_Control($wp_customize, "constructionarc_footer_overlay_color", array(
        'section' => "constructionarc_{$id}_section",
        'label' => esc_html__('Overlay Color', 'construction-arc'),
    )));

    $wp_customize->add_setting(
        "constructionarc_{$id}_padding",
        array(
            'transport' => 'postMessage',
            'sanitize_callback' => 'constructionarc_themes_sanitize_field_default_css_box'
        )
    );
    $wp_customize->add_control(
        new constructionarc_Themes_Custom_Control_Cssbox(
            $wp_customize,
            "constructionarc_{$id}_padding",
            array(
                'label'    => esc_html__( 'Padding', 'construction-arc' ),
                'section' => "constructionarc_{$id}_section",
            ),
            array(),
            array()
        )
    );


    $wp_customize->add_setting("constructionarc_{$id}_seperator0", array(
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control(new constructionarc_Separator_Control($wp_customize, "constructionarc_{$id}_seperator0", array(
        'section' => "constructionarc_{$id}_section",
    )));

    $wp_customize->add_setting("constructionarc_{$id}_section_seperator", array(
        'sanitize_callback' => 'sanitize_text_field',
        'default' => 'no',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control("constructionarc_{$id}_section_seperator", array(
        'section' => "constructionarc_{$id}_section",
        'type' => 'select',
        'label' => esc_html__('Choose Separator', 'construction-arc'),
        'choices' => array(
            'no' => esc_html__('Disable', 'construction-arc'),
            'top' => esc_html__('Top Separator', 'construction-arc'),
        )
    ));

    $wp_customize->add_setting("constructionarc_{$id}_top_seperator", array(
        'sanitize_callback' => 'sanitize_text_field',
        'default' => 'curv-8',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control("constructionarc_{$id}_top_seperator", array(
        'section' => "constructionarc_{$id}_section",
        'type' => 'select',
        'label' => esc_html__('Top Separator', 'construction-arc'),
        'choices' => constructionarc_themes_svg_seperator(),
    ));

    $wp_customize->add_setting("constructionarc_{$id}_ts_color", array(
        'default' => '',
        'sanitize_callback' => 'constructionarc_themes_sanitize_color_alpha',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control(new constructionarc_Alpha_Color_Control($wp_customize, "constructionarc_{$id}_ts_color", array(
        'section' => "constructionarc_{$id}_section",
        'label' => esc_html__('Top Separator Color', 'construction-arc'),
    )));

    $wp_customize->add_setting("constructionarc_{$id}_ts_height_desktop", array(
        'sanitize_callback' => 'sanitize_text_field',
        'default' => 60,
        'transport' => 'postMessage'
    ));
    $wp_customize->add_setting("constructionarc_{$id}_ts_height_tablet", array(
        'sanitize_callback' => 'sanitize_text_field',
        'default' => 40,
        'transport' => 'postMessage'
    ));
    $wp_customize->add_setting("constructionarc_{$id}_ts_height_mobile", array(
        'sanitize_callback' => 'sanitize_text_field',
        'default' => 20,
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control(new constructionarc_Range_Slider_Control($wp_customize, "constructionarc_{$id}_ts_height", array(
        'section' => "constructionarc_{$id}_section",
        'label' => esc_html__('Top Separator Height', 'construction-arc'),
        'settings' => array(
            'desktop' => "constructionarc_{$id}_ts_height_desktop",
            'tablet' => "constructionarc_{$id}_ts_height_tablet",
            'mobile' => "constructionarc_{$id}_ts_height_mobile",
        ),
        'input_attrs' => array(
            'min' => 20,
            'max' => 500,
            'step' => 1,
        )
    )));

    $wp_customize->add_setting('constructionarc_pro_footer', array(
        'sanitize_callback' => 'constructionarc_sanitize_text'
    ));
    $wp_customize->add_control(new constructionarc_Themes_Upgrade_Text($wp_customize, 'constructionarc_pro_footer', array(
        'section' => 'constructionarc_footer_section',
        'label' => esc_html__('For More Settings,', 'construction-arc'),
        'choices' => array(
            esc_html__('Different footer styles', 'construction-arc'),
            esc_html__('Enable/Disable Footer & Sub Footer', 'construction-arc'),
            esc_html__('Set custom footer columns & width', 'construction-arc'),
            esc_html__('Remove footer credit text', 'construction-arc'),
            esc_html__('Change title & link, hover Color', 'construction-arc'),
            esc_html__('4+ Different Background Options( Color/Video/Gradient/Image ) ', 'construction-arc'),
            esc_html__('More Than 35+ Separator Shape Illustrator with Color & Height Option', 'construction-arc'),
        ),
        'priority' => 250,
    )));

$wp_customize->selective_refresh->add_partial( 'constructionarc_footer_bg_video', array(
    'selector'        => '#footer-section',
    'container_inclusive'  => true,
    'render_callback' => function() {
        do_action( 'constructionarc_themes_top_footer_content' );
    }
) );

$wp_customize->selective_refresh->add_partial( 'constructionarc_footer_section', array(
    'settings'        => [ 'constructionarc_footer_top_seperator', 'constructionarc_footer_section_seperator' ],
    'selector'        => '.footer-seprator',
    'container_inclusive'  => false,
    'render_callback' => function() {
        constructionarc_themes_add_footer_seperator();
    }
) );


