<?php
/**
 * About Page Settings.
 *
 * @package pawfect
 */

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

/**
 * About Page Settings.
 */

if ( ! class_exists( 'pawfect_Customize_About_Option' ) ) :

    class pawfect_Customize_About_Option extends pawfect_Customize_Base_Option {

        public function elements() {

            return array(

                'pawfect_about_heading' => array(
                    'setting' => array(),
                    'control' => array(
                        'type'    => 'heading',
                        'priority' => 1,
                        'label'   => esc_html__( 'About Page Settings', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                    ),
                ),

                // About Section Title
                'pawfect_about_section_title' => array(
                    'setting' => array(
                        'default' => 'Rooted in Love, Built for Paws',
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type'    => 'text',
                        'priority' => 10,
                        'label'   => esc_html__( 'About Section Title', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                    ),
                ),

                // About Section Description
                'pawfect_about_section_description' => array(
                    'setting' => array(
                        'default' => 'We create thoughtful, high-quality essentials that keep tails wagging — and hearts full.',
                        'sanitize_callback' => 'sanitize_textarea_field',
                    ),
                    'control' => array(
                        'type'    => 'textarea',
                        'priority' => 15,
                        'label'   => esc_html__( 'About Section Description', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                    ),
                ),

                // Why Choose Section Enable/Disable
                'pawfect_about_why_choose_enable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type'    => 'toggle',
                        'priority' => 20,
                        'label'   => esc_html__( 'Enable Why Choose Section', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                    ),
                ),





                // Mission Section Heading
                'pawfect_about_mission_heading' => array(
                    'setting' => array(),
                    'control' => array(
                        'type'    => 'heading',
                        'priority' => 50,
                        'label'   => esc_html__( 'Mission Section', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                    ),
                ),

                // Mission Section Enable/Disable
                'pawfect_about_mission_enable' => array(
                    'setting' => array(
                        'default' => false,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type'    => 'toggle',
                        'priority' => 55,
                        'label'   => esc_html__( 'Enable Mission Section', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                    ),
                ),

                // Mission Section Title
                'pawfect_about_mission_title' => array(
                    'setting' => array(
                        'default' => 'Our Mission',
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type'    => 'text',
                        'priority' => 60,
                        'label'   => esc_html__( 'Mission Section Title', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                        'active_callback' => 'pawfect_about_mission_enabled',
                    ),
                ),

                // Mission Section Description
                'pawfect_about_mission_description' => array(
                    'setting' => array(
                        'default' => 'To create products that strengthen the bond between pets and their families.',
                        'sanitize_callback' => 'sanitize_textarea_field',
                    ),
                    'control' => array(
                        'type'    => 'textarea',
                        'priority' => 65,
                        'label'   => esc_html__( 'Mission Section Description', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                        'active_callback' => 'pawfect_about_mission_enabled',
                    ),
                ),

                // Testimonial Section Heading
                'pawfect_about_testimonial_heading' => array(
                    'setting' => array(),
                    'control' => array(
                        'type'    => 'heading',
                        'priority' => 70,
                        'label'   => esc_html__( 'Testimonial Section', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                    ),
                ),

                // Testimonial Section Enable/Disable
                'pawfect_about_testimonial_enable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type'    => 'toggle',
                        'priority' => 75,
                        'label'   => esc_html__( 'Enable Testimonial Section', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                    ),
                ),



                // Enable Promo Banner Section on About Page
                'pawfect_about_promo_banner_enable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type'    => 'toggle',
                        'priority' => 90,
                        'label'   => esc_html__( 'Enable Promo Banner Section', 'pawfect' ),
                        'section' => 'pawfect_about_page_settings',
                    ),
                ),

            );

        }

    }

    // Remove automatic instantiation - let main customizer class handle this
    // new pawfect_Customize_About_Option();

endif;

// Active callback functions


function pawfect_about_mission_enabled( $control ) {
    return get_theme_mod( 'pawfect_about_mission_enable', false ) === true;
}

function pawfect_about_testimonial_enabled( $control ) {
    return get_theme_mod( 'pawfect_about_testimonial_enable', true ) === true;
}
