<?php
/**
 * Theme Customizer Controls
 *
 * @package shop-zen
 */

defined( 'ABSPATH' ) || exit;


if ( ! function_exists( 'shop_zen_customizer_footer_register' ) ) :
function shop_zen_customizer_footer_register( $wp_customize ) {
 	
 	/**
     * Footer Settings Section
     */
    $wp_customize->add_section(
        'shop_zen_footer_settings',
        array(
            'priority'   => 25,
            'capability' => 'edit_theme_options',
            'title'      => esc_html__( 'Footer Settings', 'shop-zen' ),
        )
    );

    // Title label - Copyright
    $wp_customize->add_setting(
        'shop_zen_footer_copyright_label',
        array(
            'sanitize_callback' => 'shop_zen_sanitize_title',
        )
    );

    $wp_customize->add_control(
        new Shop_Zen_Title_Info_Control( $wp_customize, 'shop_zen_footer_copyright_label',
        array(
            'label'    => esc_html__( 'Copyright Settings', 'shop-zen' ),
            'section'  => 'shop_zen_footer_settings',
            'type'     => 'shop-zen-title',
            'settings' => 'shop_zen_footer_copyright_label',
        )
    ));

    // Copyright text
    $wp_customize->add_setting(
        'shop_zen_footer_copyright_text',
        array(
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_textarea_field',
        )
    );

    $wp_customize->add_control(
        'shop_zen_footer_copyright_text',
        array(
            'settings'    => 'shop_zen_footer_copyright_text',
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'textarea',
            'label'       => esc_html__( 'Footer Copyright Text', 'shop-zen' ),
            'description' => esc_html__( 'Copyright text to be displayed in the footer. No HTML allowed.', 'shop-zen' ),
        )
    );

    // Title label - Footer Bottom Links
    $wp_customize->add_setting(
        'shop_zen_footer_bottom_links_label',
        array(
            'sanitize_callback' => 'shop_zen_sanitize_title',
        )
    );

    $wp_customize->add_control(
        new Shop_Zen_Title_Info_Control( $wp_customize, 'shop_zen_footer_bottom_links_label',
        array(
            'label'    => esc_html__( 'Footer Bottom Links', 'shop-zen' ),
            'section'  => 'shop_zen_footer_settings',
            'type'     => 'shop-zen-title',
            'settings' => 'shop_zen_footer_bottom_links_label',
        )
    ));

    // Privacy Policy URL
    $wp_customize->add_setting(
        'shop_zen_footer_privacy_policy_url',
        array(
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_url',
        )
    );

    $wp_customize->add_control(
        'shop_zen_footer_privacy_policy_url',
        array(
            'settings'    => 'shop_zen_footer_privacy_policy_url',
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'url',
            'label'       => esc_html__( 'Privacy Policy URL', 'shop-zen' ),
            'description' => esc_html__( 'Enter the URL for the Privacy Policy page.', 'shop-zen' ),
        )
    );

    // Cookie Policy URL
    $wp_customize->add_setting(
        'shop_zen_footer_cookie_policy_url',
        array(
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_url',
        )
    );

    $wp_customize->add_control(
        'shop_zen_footer_cookie_policy_url',
        array(
            'settings'    => 'shop_zen_footer_cookie_policy_url',
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'url',
            'label'       => esc_html__( 'Cookie Policy URL', 'shop-zen' ),
            'description' => esc_html__( 'Enter the URL for the Cookie Policy page.', 'shop-zen' ),
        )
    );

    // Terms & Conditions URL
    $wp_customize->add_setting(
        'shop_zen_footer_terms_url',
        array(
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_url',
        )
    );

    $wp_customize->add_control(
        'shop_zen_footer_terms_url',
        array(
            'settings'    => 'shop_zen_footer_terms_url',
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'url',
            'label'       => esc_html__( 'Terms & Conditions URL', 'shop-zen' ),
            'description' => esc_html__( 'Enter the URL for the Terms & Conditions page.', 'shop-zen' ),
        )
    );

    // Title label - Trust Badges
    $wp_customize->add_setting(
        'shop_zen_footer_trust_badges_label',
        array(
            'sanitize_callback' => 'shop_zen_sanitize_title',
        )
    );

    $wp_customize->add_control(
        new Shop_Zen_Title_Info_Control( $wp_customize, 'shop_zen_footer_trust_badges_label',
        array(
            'label'    => esc_html__( 'Trust Badges', 'shop-zen' ),
            'section'  => 'shop_zen_footer_settings',
            'type'     => 'shop-zen-title',
            'settings' => 'shop_zen_footer_trust_badges_label',
        )
    ));

    // Trust Badges - Show Icons
    $wp_customize->add_setting(
        'shop_zen_footer_trust_badges_icons',
        array(
            'default'           => false,
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_checkbox',
            'transport'         => 'refresh',
        )
    );

    $wp_customize->add_control(
        new Shop_Zen_Toggle_Control( $wp_customize, 'shop_zen_footer_trust_badges_icons',
        array(
            'label'       => esc_html__( 'Show Badge Icons', 'shop-zen' ),
            'description' => esc_html__( 'Display the icon next to each trust badge.', 'shop-zen' ),
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'shop-zen-toggle',
            'settings'    => 'shop_zen_footer_trust_badges_icons',
        )
    ));

    // Secure Checkout - Enable
    $wp_customize->add_setting(
        'shop_zen_footer_secure_checkout_enable',
        array(
            'default'           => false,
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_checkbox',
            'transport'         => 'refresh',
        )
    );

    $wp_customize->add_control(
        new Shop_Zen_Toggle_Control( $wp_customize, 'shop_zen_footer_secure_checkout_enable',
        array(
            'label'       => esc_html__( 'Secure Checkout', 'shop-zen' ),
            'description' => esc_html__( 'Display the Secure Checkout trust badge in the footer.', 'shop-zen' ),
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'shop-zen-toggle',
            'settings'    => 'shop_zen_footer_secure_checkout_enable',
        )
    ));

    // Secure Checkout - Text
    $wp_customize->add_setting(
        'shop_zen_footer_secure_checkout_text',
        array(
            'default'           => esc_html__( 'Secure Checkout', 'shop-zen' ),
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_text_field',
            'transport'         => 'refresh',
        )
    );

    $wp_customize->add_control(
        'shop_zen_footer_secure_checkout_text',
        array(
            'settings'    => 'shop_zen_footer_secure_checkout_text',
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'text',
            'label'       => esc_html__( 'Secure Checkout Text', 'shop-zen' ),
            'description' => esc_html__( 'Customize the label text for the Secure Checkout badge.', 'shop-zen' ),
        )
    );

    // Free Returns - Enable
    $wp_customize->add_setting(
        'shop_zen_footer_free_returns_enable',
        array(
            'default'           => false,
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_checkbox',
            'transport'         => 'refresh',
        )
    );

    $wp_customize->add_control(
        new Shop_Zen_Toggle_Control( $wp_customize, 'shop_zen_footer_free_returns_enable',
        array(
            'label'       => esc_html__( 'Free Returns', 'shop-zen' ),
            'description' => esc_html__( 'Display the Free Returns trust badge in the footer.', 'shop-zen' ),
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'shop-zen-toggle',
            'settings'    => 'shop_zen_footer_free_returns_enable',
        )
    ));

    // Free Returns - Text
    $wp_customize->add_setting(
        'shop_zen_footer_free_returns_text',
        array(
            'default'           => esc_html__( 'Free Returns', 'shop-zen' ),
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_text_field',
            'transport'         => 'refresh',
        )
    );

    $wp_customize->add_control(
        'shop_zen_footer_free_returns_text',
        array(
            'settings'    => 'shop_zen_footer_free_returns_text',
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'text',
            'label'       => esc_html__( 'Free Returns Text', 'shop-zen' ),
            'description' => esc_html__( 'Customize the label text for the Free Returns badge.', 'shop-zen' ),
        )
    );

    // Carbon Neutral - Enable
    $wp_customize->add_setting(
        'shop_zen_footer_carbon_neutral_enable',
        array(
            'default'           => false,
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_checkbox',
            'transport'         => 'refresh',
        )
    );

    $wp_customize->add_control(
        new Shop_Zen_Toggle_Control( $wp_customize, 'shop_zen_footer_carbon_neutral_enable',
        array(
            'label'       => esc_html__( 'Carbon Neutral', 'shop-zen' ),
            'description' => esc_html__( 'Display the Carbon Neutral trust badge in the footer.', 'shop-zen' ),
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'shop-zen-toggle',
            'settings'    => 'shop_zen_footer_carbon_neutral_enable',
        )
    ));

    // Carbon Neutral - Text
    $wp_customize->add_setting(
        'shop_zen_footer_carbon_neutral_text',
        array(
            'default'           => esc_html__( 'Carbon Neutral', 'shop-zen' ),
            'type'              => 'theme_mod',
            'sanitize_callback' => 'shop_zen_sanitize_text_field',
            'transport'         => 'refresh',
        )
    );

    $wp_customize->add_control(
        'shop_zen_footer_carbon_neutral_text',
        array(
            'settings'    => 'shop_zen_footer_carbon_neutral_text',
            'section'     => 'shop_zen_footer_settings',
            'type'        => 'text',
            'label'       => esc_html__( 'Carbon Neutral Text', 'shop-zen' ),
            'description' => esc_html__( 'Customize the label text for the Carbon Neutral badge.', 'shop-zen' ),
        )
    );
}
endif;

add_action( 'customize_register', 'shop_zen_customizer_footer_register' );