<?php
/**
 * Defines Top Bar settings for the Customizer.
 *
 * @package Pawfect
 */

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

if ( ! class_exists( 'Pawfect_Options_Top_Bar' ) ) :

    /**
     * The Top Bar options class.
     */
    class Pawfect_Options_Top_Bar extends pawfect_Customize_Base_Option {

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

            return array(

                /**
                 * Master Toggle for the entire Top Bar.
                 */
                'pawfect_topbar_enabled' => array(
                    'setting' => array(
                        'default'           => true,
                        'sanitize_callback' => array( 'pawfect_Customizer_Sanitize', 'sanitize_checkbox' ),
                    ),
                    'control' => array(
                        'type'     => 'toggle',
                        'priority' => 1,
                        'label'    => esc_html__( 'Enable Top Bar', 'pawfect' ),
                        'section'  => 'pawfect_topbar_settings',
                    ),
                ),

                // =======================================================
                // == 1. TOP BAR DETAILS
                // =======================================================

                'pawfect_topbar_details_heading' => array(
                    'setting' => array(),
                    'control' => array(
                        'type'            => 'heading',
                        'priority'        => 5,
                        'label'           => esc_html__( 'Top Bar Details', 'pawfect' ),
                        'section'         => 'pawfect_topbar_settings',
                        'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ],
                    ),
                ),

                'pawfect_topbar_num' => array(
                    'setting' => array(
                        'default'           => esc_html__( '(901)-2345-6789', 'pawfect' ),
                        'sanitize_callback' => 'sanitize_text_field',
                        'transport'         => 'postMessage',
                    ),
                    'control' => array(
                        'type'            => 'text', // 'num' is not a standard type
                        'priority'        => 6,
                        'label'           => esc_html__( 'Phone Detail', 'pawfect' ),
                        'section'         => 'pawfect_topbar_settings',
                        'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ],
                    ),
                ),

                'pawfect_topbar_text' => array(
                    'setting' => array(
                        'default'           => esc_html__( 'Request a Callback', 'pawfect' ),
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type'            => 'text',
                        'priority'        => 10,
                        'label'           => esc_html__( 'Text', 'pawfect' ),
                        'section'         => 'pawfect_topbar_settings',
                        'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ],
                    ),
                ),

                'pawfect_topbar_button' => array(
                    'setting' => array(
                        'default'           => esc_html__( 'Get Started', 'pawfect' ),
                        'sanitize_callback' => 'sanitize_text_field',
                        'transport'         => 'postMessage',
                    ),
                    'control' => array(
                        'type'            => 'text',
                        'priority'        => 15,
                        'label'           => esc_html__( 'Button Text', 'pawfect' ),
                        'section'         => 'pawfect_topbar_settings',
                        'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ],
                    ),
                ),

                'pawfect_topbar_button_link' => array(
                    'setting' => array(
                        'default'           => '#',
                        'sanitize_callback' => 'esc_url_raw',
                    ),
                    'control' => array(
                        'type'            => 'url',
                        'priority'        => 16,
                        'label'           => esc_html__( 'Button URL', 'pawfect' ),
                        'section'         => 'pawfect_topbar_settings',
                        'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ],
                    ),
                ),

                // =======================================================
                // == 2. SOCIAL ICONS
                // =======================================================

                'pawfect_social_icons_heading' => array(
                    'setting' => array(),
                    'control' => array(
                        'type'            => 'heading',
                        'priority'        => 20,
                        'label'           => esc_html__( 'Social Icons', 'pawfect' ),
                        'section'         => 'pawfect_topbar_settings',
                        'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ],
                    ),
                ),

                'pawfect_facebook_url' => array(
                    'setting' => [ 'default' => '', 'sanitize_callback' => 'esc_url_raw' ],
                    'control' => [ 'type' => 'url', 'priority' => 25, 'section' => 'pawfect_topbar_settings', 'description' => esc_html__( 'Facebook URL', 'pawfect' ), 'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ] ],
                ),

                'pawfect_twitter_url' => array(
                    'setting' => [ 'default' => '', 'sanitize_callback' => 'esc_url_raw' ],
                    'control' => [ 'type' => 'url', 'priority' => 35, 'section' => 'pawfect_topbar_settings', 'description' => esc_html__( 'Twitter URL', 'pawfect' ), 'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ] ],
                ),

                'pawfect_linkedin_url' => array(
                    'setting' => [ 'default' => '', 'sanitize_callback' => 'esc_url_raw' ],
                    'control' => [ 'type' => 'url', 'priority' => 36, 'section' => 'pawfect_topbar_settings', 'description' => esc_html__( 'LinkedIn URL', 'pawfect' ), 'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ] ],
                ),

                'pawfect_youtube_url' => array(
                    'setting' => [ 'default' => '', 'sanitize_callback' => 'esc_url_raw' ],
                    'control' => [ 'type' => 'url', 'priority' => 38, 'section' => 'pawfect_topbar_settings', 'description' => esc_html__( 'YouTube URL', 'pawfect' ), 'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ] ],
                ),

                'pawfect_instagram_url' => array(
                    'setting' => [ 'default' => '', 'sanitize_callback' => 'esc_url_raw' ],
                    'control' => [ 'type' => 'url', 'priority' => 41, 'section' => 'pawfect_topbar_settings', 'description' => esc_html__( 'Instagram URL', 'pawfect' ), 'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ] ],
                ),

                'pawfect_tumblr_url' => array(
                    'setting' => [ 'default' => '', 'sanitize_callback' => 'esc_url_raw' ],
                    'control' => [ 'type' => 'url', 'priority' => 46, 'section' => 'pawfect_topbar_settings', 'description' => esc_html__( 'Tumblr URL', 'pawfect' ), 'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ] ],
                ),

                'pawfect_telegram_url' => array(
                    'setting' => [ 'default' => '', 'sanitize_callback' => 'esc_url_raw' ],
                    'control' => [ 'type' => 'url', 'priority' => 48, 'section' => 'pawfect_topbar_settings', 'description' => esc_html__( 'Telegram URL', 'pawfect' ), 'active_callback' => [ [ $this, 'is_control_value_active' ], 'pawfect_topbar_enabled', true ] ],
                ),

            );
        }
    }

    // Instantiate the class so its settings get registered.
    new Pawfect_Options_Top_Bar();

endif;
