<?php
/**
 * Customizer helper that defines functions related to customizer panels, sections, and settings.
 * 
 * Provides utility functions to manage and register Customizer options for the theme.
 *
 * @package Yaatra
 */

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


/*---------------------------------- General Panel Choices -----------------------------*/

  
    if ( ! function_exists( 'yaatra_site_layout_choices' ) ) :

        /**
         * function to return choices of site layout.
         *
         * @since 1.5.0
         */
        function yaatra_site_layout_choices() {

            $site_layout_choices = apply_filters( 'yaatra_site_layout_choices',
                array(
                    'fullwidth_layout'  => array(
                        'title' => __( 'Full Width', 'yaatra' ),
                        'src'   => get_template_directory_uri() . '/inc/customizer/assets/images/full-width.png'
                    ),
                    'boxed_layout'      => array(
                        'title' => __( 'Boxed', 'yaatra' ),
                        'src'   => get_template_directory_uri() . '/inc/customizer/assets/images/boxed.png'
                    )
                )
            );

            return $site_layout_choices;

        }

    endif;


/*-------------------------------------------------------------------------*/

   if ( ! function_exists( 'yaatra_preloader_style_choices' ) ) :

        /**
         * function to return choices for preloader styles.
         *
         * @since 1.0.0
         */
        function yaatra_preloader_style_choices() {

            $site_container_layout = apply_filters( 'yaatra_preloader_style_choices',
                array(
                    'three_bounce'    => array(
                        'title'     => __( 'Three Bounce', 'yaatra' ),
                        'src'       => get_template_directory_uri() . '/inc/customizer/assets/images/three-bounce-preloader.gif'
                    ),
                    'wave'         => array(
                        'title'     => __( 'Wave', 'yaatra' ),
                        'src'       => get_template_directory_uri() . '/inc/customizer/assets/images/wave-preloader.gif'
                    ),
                    'folding_cube'         => array(
                        'title'     => __( 'Folding Cube', 'yaatra' ),
                        'src'       => get_template_directory_uri() . '/inc/customizer/assets/images/folding-cube-preloader.gif'
                    )
                )
            );

            return $site_container_layout;

        }

    endif;
    
/*----------------------Sidebar Layout Choices -------------------------------*/

    if ( ! function_exists( 'yaatra_sidebar_layout_choices' ) ) :

        /**
         * Returns options for archive sidebar layouts.
         *
         * Provides a list of layout choices for the sidebar in archive pages.
         *
         * @since 1.0.0
         */
        function yaatra_sidebar_layout_choices() {

            $sidebar_layouts = apply_filters( 'yaatra_sidebar_layout_choices',
                array(
                    'right_sidebar'    => array(
                        'title'     => __( 'Right Sidebar', 'yaatra' ),
                        'src'       => get_template_directory_uri() . '/inc/customizer/assets/images/right-sidebar.png'
                    ),
                    'left_sidebar'  => array(
                        'title'     => __( 'Left Sidebar', 'yaatra' ),
                        'src'       => get_template_directory_uri() . '/inc/customizer/assets/images/left-sidebar.png'
                    ),
                    'both_sidebar'  => array(
                        'title'     => __( 'Both Sidebar', 'yaatra' ),
                        'src'       => get_template_directory_uri() . '/inc/customizer/assets/images/both-sidebar.png'
                    ),
                    'no_sidebar'  => array(
                        'title'     => __( 'No Sidebar', 'yaatra' ),
                        'src'       => get_template_directory_uri() . '/inc/customizer/assets/images/no-sidebar.png'
                    )
                )
            );

            return $sidebar_layouts;

        }

    endif;

/*---------------------------------- Header Panel Choices ------------------------------*/

    if ( ! function_exists( 'yaatra_site_identity_tabs_choices' ) ) :

        /**
         * Returns options for site identity tabs.
         *
         * Provides a list of field choices for the tabs.
         *
         * @since 1.1.0
         */
        function yaatra_site_identity_tabs_choices() {

            $site_identity_tabs = apply_filters( 'yaatra_site_identity_tabs_choices',
                array(
                    'general'   => array(
                        'title'     => __( 'General', 'yaatra' ),
                        'fields'    => array(
                            'custom_logo',
                            'blogname',
                            'blogdescription',
                            'display_header_text',
                            'site_icon',

                        )
                    ),
                    'design'    => array(
                        'title' => __( 'Design', 'yaatra' ),
                        'fields'    => array(
                            'header_textcolor'
                        )
                    )
                )
            );

            return $site_identity_tabs;

        }

    endif;

/*---------------------------------- Innerpage Panel Choices ---------------------------*/

    if ( ! function_exists( 'yaatra_archive_pages_layout_choices' ) ) :

        /**
         * Returns layout choices for archive pages.
         *
         * Provides options for configuring the layout of archive pages (e.g., grid, list).
         *
         * @since 1.1.0
         */
        function yaatra_archive_pages_layout_choices() {

            $archive_page_layout = apply_filters( 'yaatra_archive_pages_layout_choices',
                array(
                    'grid'    => array(
                        'title'     => __( 'Grid', 'yaatra' ),
                        'src'       => get_template_directory_uri() . '/inc/customizer/assets/images/archive-layout2.png'
                    ),
                    'classic-grid'         => array(
                        'title'     => __( 'Classic Grid', 'yaatra' ),
                        'src'       => get_template_directory_uri() . '/inc/customizer/assets/images/archive-layout1.png'
                    )
                )
            );

            return $archive_page_layout;

        }

    endif;

    if ( ! function_exists( 'yaatra_single_posts_related_orderby_choices' ) ) :

        /**
         * Returns choices for ordering related posts on single post pages.
         *
         * Provides options for how related posts should be sorted (e.g., by date, relevance) on single post pages.
         *
         * @since 1.0.0
         */
        function yaatra_single_posts_related_orderby_choices() {

            $single_posts_related_orderby = apply_filters( 'yaatra_single_posts_related_orderby_choices',
                array(
                    'rp_default'    => __( 'Default', 'yaatra' ),
                    'rp_rand'       => __( 'Random', 'yaatra' )
                )
            );

            return $single_posts_related_orderby;

        }

    endif;

/*---------------------------------- Upgrade Control Choices ---------------------------*/
    
    if ( ! function_exists( 'yaatra_upgrade_choices' ) ) :

        /**
		 * Function to return choices for upgrading to the pro version.
		 *
		 * Provides a list of options or prompts to encourage users to upgrade to the pro version of the theme.
		 *
		 * @since 1.0.0
		 */
        function yaatra_upgrade_choices( $setting_id ) {

            $upgrade_info_lists = array(
                'preloader'     => array( __( 'Color options', 'yaatra' ), __( 'Device visibility', 'yaatra' ) ),
                
                'site_style'   => array( __( 'Additional Site Mode Options', 'yaatra' ) ),
                'social_icon'   => array( __( 'Unlimited Social Icons', 'yaatra' ), __( 'Expand Icons with Official Branding Colors', 'yaatra' ), __( 'Device Visibility Settings', 'yaatra' ) ),
                'frontpage_banner'   => array( __( '3+ Additional Banner Layouts', 'yaatra' ), __( 'Advanced Slider Features', 'yaatra' ), __( 'New Featured Content', 'yaatra' ), __( 'Reorder Sections', 'yaatra' ) ),
                'archive' => array( __( 'Explore New Archive Styles', 'yaatra' ), __( 'Add 3 Additional Post Layouts', 'yaatra' ), __( 'Pagination Type Options', 'yaatra' ) ),
                'single_post' => array( __( 'Add 3 Additional Post Layouts', 'yaatra' ) )
            );

            $setting_id = explode( 'yaatra_', $setting_id );
            $setting_id = $setting_id[1];

            return $upgrade_info_lists[$setting_id];

        }

    endif;