<?php
/**
 * Defines Gradient Color settings for the Customizer.
 *
 * @package Pawfect
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

if ( ! class_exists( 'Pawfect_Options_Gradient' ) ) :

    /**
     * The Gradient options class.
     */
    class Pawfect_Options_Gradient extends pawfect_Customize_Base_Option {

        /**
         * Get all the settings and controls.
         *
         * @return array
         */
        public function elements() {

            return array(

                /**
                 * Master Toggle for Gradient Colors
                 * This allows users to enable or disable gradient color settings.
                 */
                'pawfect_gradient_colors_disabled' => array(
                    'setting' => array(
                        'default'           => false, // Disabled by default
                        'sanitize_callback' => array( 'pawfect_Customizer_Sanitize', 'sanitize_checkbox' ),
                    ),
                    'control' => array(
                        'type'     => 'toggle',
                        'priority' => 1,
                        'label'    => esc_html__( 'Enable Gradient Colors', 'pawfect' ),
                        'section'  => 'pawfect_theme_color_settings', // Assumes a section with this ID exists
                    ),
                ),

                /**
                 * Gradient Color #1
                 * This setting controls the top-left color of the header gradient.
                 */
                'pawfect_grad_color_one' => array(
                    'setting' => array(
                        'default'           => '#FDCE39',
                        'sanitize_callback' => 'sanitize_hex_color',
                        'transport'         => 'postMessage',
                    ),
                    'control' => array(
                        'type'            => 'color',
                        'priority'        => 15,
                        'section'         => 'pawfect_theme_color_settings',
                        'label'           => esc_html__( 'Header Gradient: Top-Left Color', 'pawfect' ),
                        'description'     => esc_html__( 'Set the upper left gradient starting color.', 'pawfect' ),
                        'active_callback' => [
                            [ $this, 'is_control_value_active' ],
                            'pawfect_gradient_colors_disabled',
                            true,
                        ],
                    ),
                ),

                /**
                 * Gradient Color #2 (Example - you can add more like this)
                 * This setting would control the bottom-right color of the header gradient.
                 */
                'pawfect_grad_color_two' => array(
                    'setting' => array(
                        'default'           => '#DF4E6B', // Example color
                        'sanitize_callback' => 'sanitize_hex_color',
                        'transport'         => 'postMessage',
                    ),
                    'control' => array(
                        'type'            => 'color',
                        'priority'        => 20,
                        'section'         => 'pawfect_theme_color_settings',
                        'label'           => esc_html__( 'Header Gradient: Bottom-Right Color', 'pawfect' ),
                        'description'     => esc_html__( 'Set the lower right gradient ending color.', 'pawfect' ),
                        'active_callback' => [
                            [ $this, 'is_control_value_active' ],
                            'pawfect_gradient_colors_disabled',
                            true,
                        ],
                    ),
                ),

            );
        }
    }

    // Instantiate the class so its settings get registered.
    // Remove automatic instantiation - let main customizer class handle this
    // new Pawfect_Options_Gradient();

endif;
