<?php
    /**
     * Register customizer panels
     * 
     * @package Blog Bee
     * @since 1.0.0
     */

    namespace BBE\Customizer;

    if( ! class_exists( __NAMESPACE__ . '\\Panels' ) ){
        /**
         * Panels class
         */
        class Panels {
            /**
             * Instance
             * 
             * @since 1.0.0
             */
            private static $instance = null;

            /**
             * Get instance
             * 
             * @since 1.0.0
             */
            public static function get_instance() {
                if( self::$instance === null ) {
                    self::$instance = new self();
                }

                return self::$instance;
            }

            /**
             * All registered panel ids
             * 
             * @since 1.0.0
             * @var array
             */
            private static $panels = [];

            /**
             * Get all registered panels
             * 
             * @since 1.0.0
             */
            public static function get_panels() {
                self::$panels = [
                    'global_panel'  =>  [
                        'title' =>  esc_html__( 'Global', 'blog-bee' ),
                        'priority'  =>  20
                    ],
                    'blog_panel'  =>  [
                        'title' =>  esc_html__( 'Blog / Archives', 'blog-bee' ),
                        'priority'  =>  50
                    ],
                    'colors_panel'  =>  [
                        'title' =>  esc_html__( 'Colors', 'blog-bee' ),
                        'priority'  =>  20
                    ],
                ];
                return static::$panels;
            }

            /**
             * Add a panel
             * 
             * @since 1.0.0
             */
            public static function add_panel( $id, $args ) {
                self::$panels[ $id ] = $args;
            }

            /**
             * Add multiple panels
             * 
             * @since 1.0.0
             */
            public static function add_panels( $panels ) {
                self::$panels = array_merge( self::$panels, $panels );
            }
        }
    }