<?php
/**
 * Contact Page Options
 *
 * @package Pawfect
 */

// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

if (!class_exists('Pawfect_Options_Contact')):

    class Pawfect_Options_Contact extends pawfect_Customize_Base_Option
    {

        public function elements()
        {

            return array(

                // Contact Settings Heading
                'pawfect_contact_heading' => array(
                    'setting' => array(),
                    'control' => array(
                        'type'     => 'heading',
                        'priority' => 10,
                        'label'    => esc_html__('Contact Page Settings', 'pawfect'),
                        'section'  => 'pawfect_theme_contact_page',
                    ),
                ),

                // Google Map Heading
                'pawfect_map_heading' => array(
                    'setting' => array(),
                    'control' => array(
                        'type'     => 'heading',
                        'priority' => 30,
                        'label'    => esc_html__('Map Settings', 'pawfect'),
                        'section'  => 'pawfect_theme_contact_page',
                    ),
                ),

                // Google Map Enable
                'pawfect_template_contact_form_map_disable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type' => 'toggle',
                        'priority' => 31,
                        'label' => esc_html__('Enable Google Map', 'pawfect'),
                        'section' => 'pawfect_theme_contact_page',
                    ),
                ),

                // Map Contact Info Enable
                'pawfect_template_contact_form_map_info_disable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type' => 'toggle',
                        'priority' => 32,
                        'label' => esc_html__('Enable Map Contact Info', 'pawfect'),
                        'description' => esc_html__('Show Address, Email, Phone under the map section.', 'pawfect'),
                        'section' => 'pawfect_theme_contact_page',
                    ),
                ),

                // Map Embedded URL
                'pawfect_contact_map_url' => array(
                    'setting' => array(
                        'default'           => 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3022.682842823513!2d-73.98197368459378!3d40.75058797932681!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c259a9b3117469%3A0xd134e199a405a163!2sEmpire%20State%20Building!5e0!3m2!1sen!2sus!4v1675344973537!5m2!1sen!2sus',
                        'sanitize_callback' => 'esc_url_raw',
                    ),
                    'control' => array(
                        'type'        => 'url',
                        'priority'    => 33,
                        'label'       => esc_html__('Google Maps Embed URL', 'pawfect'),
                        'description' => esc_html__('Enter the Google Maps embedded URL.', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // Map Title
                'pawfect_contact_map_title' => array(
                    'setting' => array(
                        'default'           => 'Visit Our Studio',
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type'        => 'text',
                        'priority'    => 34,
                        'label'       => esc_html__('Map Title', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // Map Description
                'pawfect_contact_map_desc' => array(
                    'setting' => array(
                        'default'           => 'We\'d love to meet your furry friend! Stop by to explore our curated range of products and get personalized support from our team.',
                        'sanitize_callback' => 'sanitize_textarea_field',
                    ),
                    'control' => array(
                        'type'        => 'textarea',
                        'priority'    => 35,
                        'label'       => esc_html__('Map Description', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // Social Icon Enable
                'pawfect_template_contact_icon_disable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type' => 'toggle',
                        'priority' => 11,
                        'label' => esc_html__('Enable Social Icon', 'pawfect'),
                        'section' => 'pawfect_theme_contact_page',
                    ),
                ),

                // Contact Form Enable
                'pawfect_template_contact_form_disable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type' => 'toggle',
                        'priority' => 12,
                        'label' => esc_html__('Enable Contact Form', 'pawfect'),
                        'section' => 'pawfect_theme_contact_page',
                    ),
                ),

                // Form Shortcode
                'pawfect_contact_form_shortcode' => array(
                    'setting' => array(
                        'default'           => '',
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type'        => 'text',
                        'priority'    => 13,
                        'label'       => esc_html__('Contact Form Shortcode', 'pawfect'),
                        'description' => esc_html__('Enter the shortcode for your contact form (e.g., [contact-form-7 id="123"]).', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // Contact Info Enable
                'pawfect_template_contact_form_info_disable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type' => 'toggle',
                        'priority' => 14,
                        'label' => esc_html__('Enable Form Info', 'pawfect'),
                        'section' => 'pawfect_theme_contact_page',
                    ),
                ),

                // Contact Info 1: Address
                'pawfect_contact_address' => array(
                    'setting' => array(
                        'default'           => '123 Luxury Lane, Petville, PV 45678',
                        'sanitize_callback' => 'sanitize_textarea_field',
                    ),
                    'control' => array(
                        'type'        => 'textarea',
                        'priority'    => 15,
                        'label'       => esc_html__('Address', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // Contact Info 2: Phone
                'pawfect_contact_phone' => array(
                    'setting' => array(
                        'default'           => '+1 (234) 567-890',
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type'        => 'text',
                        'priority'    => 16,
                        'label'       => esc_html__('Phone Number', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // Contact Info 3: Email
                'pawfect_contact_email' => array(
                    'setting' => array(
                        'default'           => 'support@pawfect.com',
                        'sanitize_callback' => 'sanitize_email',
                    ),
                    'control' => array(
                        'type'        => 'email',
                        'priority'    => 17,
                        'label'       => esc_html__('Email Address', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // Contact Info 4: Working Hours
                'pawfect_contact_working_hours' => array(
                    'setting' => array(
                        'default'           => 'Monday – Friday, 9:00 AM – 6:00 PM',
                        'sanitize_callback' => 'sanitize_textarea_field',
                    ),
                    'control' => array(
                        'type'        => 'textarea',
                        'priority'    => 18,
                        'label'       => esc_html__('Working Hours', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // Google Map Heading
                'pawfect_map_heading' => array(
                    'setting' => array(),
                    'control' => array(
                        'type'     => 'heading',
                        'priority' => 30,
                        'label'    => esc_html__('Map Settings', 'pawfect'),
                        'section'  => 'pawfect_theme_contact_page',
                    ),
                ),

                // Google Map Enable
                'pawfect_template_contact_form_map_disable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type' => 'toggle',
                        'priority' => 31,
                        'label' => esc_html__('Enable Google Map', 'pawfect'),
                        'section' => 'pawfect_theme_contact_page',
                    ),
                ),

                // Map Contact Info Enable
                'pawfect_template_contact_form_map_info_disable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type' => 'toggle',
                        'priority' => 32,
                        'label' => esc_html__('Enable Map Contact Info', 'pawfect'),
                        'description' => esc_html__('Show Address, Email, Phone under the map section.', 'pawfect'),
                        'section' => 'pawfect_theme_contact_page',
                    ),
                ),

                // Map Embedded URL
                'pawfect_contact_map_url' => array(
                    'setting' => array(
                        'default'           => 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3022.682842823513!2d-73.98197368459378!3d40.75058797932681!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c259a9b3117469%3A0xd134e199a405a163!2sEmpire%20State%20Building!5e0!3m2!1sen!2sus!4v1675344973537!5m2!1sen!2sus',
                        'sanitize_callback' => 'esc_url_raw',
                    ),
                    'control' => array(
                        'type'        => 'url',
                        'priority'    => 33,
                        'label'       => esc_html__('Google Maps Embed URL', 'pawfect'),
                        'description' => esc_html__('Enter the Google Maps embedded URL.', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // Map Title
                'pawfect_contact_map_title' => array(
                    'setting' => array(
                        'default'           => 'Visit Our Studio',
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type'        => 'text',
                        'priority'    => 34,
                        'label'       => esc_html__('Map Title', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // Map Description
                'pawfect_contact_map_desc' => array(
                    'setting' => array(
                        'default'           => 'We\'d love to meet your furry friend! Stop by to explore our curated range of products and get personalized support from our team.',
                        'sanitize_callback' => 'sanitize_textarea_field',
                    ),
                    'control' => array(
                        'type'        => 'textarea',
                        'priority'    => 35,
                        'label'       => esc_html__('Map Description', 'pawfect'),
                        'section'     => 'pawfect_theme_contact_page',
                    ),
                ),

                // FAQ Heading
                'pawfect_contact_faq_heading' => array(
                    'setting' => array(),
                    'control' => array(
                        'type'     => 'heading',
                        'priority' => 20,
                        'label'    => esc_html__('FAQ Section', 'pawfect'),
                        'section'  => 'pawfect_theme_contact_page',
                    ),
                ),

                // FAQ Enable
                'pawfect_contact_faq_enable' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type' => 'toggle',
                        'priority' => 21,
                        'label' => esc_html__('Enable FAQ Section', 'pawfect'),
                        'section' => 'pawfect_theme_contact_page',
                    ),
                ),

                // FAQ Repeater
                'pawfect_contact_faq_repeater' => array(
                    'setting' => array(
                        'default' => json_encode(array(
                            array(
                                'title' => esc_html__('What is your return policy?', 'pawfect'),
                                'text'  => esc_html__('We offer a 30-day return policy on all unused items in their original packaging. Please visit our returns page for more details on how to initiate a return.', 'pawfect'),
                                'id'    => 'customizer_repeater_faq_001',
                            ),
                            array(
                                'title' => esc_html__('How do I care for my plush bed?', 'pawfect'),
                                'text'  => esc_html__('All of our bed covers are removable and machine-washable. We recommend washing on a gentle cycle with cold water and air drying to maintain its shape and softness.', 'pawfect'),
                                'id'    => 'customizer_repeater_faq_002',
                            ),
                            array(
                                'title' => esc_html__('Do you ship internationally?', 'pawfect'),
                                'text'  => esc_html__('Yes, we ship to most countries worldwide. Shipping costs and times will be calculated at checkout based on your location.', 'pawfect'),
                                'id'    => 'customizer_repeater_faq_003',
                            ),
                        )),
                        'sanitize_callback' => 'pawfect_repeater_sanitize',
                    ),
                    'control' => array(
                        'type'                               => 'repeater',
                        'priority'                           => 22,
                        'label'                              => esc_html__('FAQ Items', 'pawfect'),
                        'section'                            => 'pawfect_theme_contact_page',
                        'add_field_label'                    => esc_html__('Add new FAQ', 'pawfect'),
                        'item_name'                          => esc_html__('FAQ Item', 'pawfect'),
                        'customizer_repeater_title_control'  => true,
                        'customizer_repeater_text_control'   => true,
                        'active_callback'                    => array($this, 'is_pro_active'),
                    ),
                ),

                // FAQ Upsale
                'pawfect_contact_faq_upsale' => array(
                    'setting' => array(
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type'            => 'pawfect-upgrade',
                        'priority'        => 23,
                        'label'           => esc_html__('FAQ Feature', 'pawfect'),
                        'section'         => 'pawfect_theme_contact_page',
                        'active_callback' => array($this, 'is_pro_inactive'),
                    ),
                ),
            );
        }

        public function is_pro_active() {
            return apply_filters('pawfect_is_pro_active', false);
        }

        public function is_pro_inactive() {
            return !apply_filters('pawfect_is_pro_active', false);
        }
    }

    new Pawfect_Options_Contact();

endif;
