<?php
    /**
     * Async Multiselect customzer custom control
     * 
     * @package Blog Bee
     * @since 1.0.0
     */
    namespace BBE\Customizer\Controls;

    use BBE\Customizer\Base as Base;
    
    if( ! class_exists( __NAMESPACE__ . '\\Async_Multiselect' ) ) {
        /**
         * Async_Multiselect Class
         */
        class Async_Multiselect extends Base {
           /**
            * Control type
            *
            * @since 1.0.0
            */
            public $type = 'async-multiselect';

            /**
            * Rest API endpoint
            *
            * @since 1.0.0
            */
            public $endpoint = 'get_posts';

            /**
            * Purpose
            *
            * @since 1.0.0
            */
            public $purpose = 'posts';

            /**
             * Add custom JSON parameters to use in the JS template.
             *
             * @since  1.0.0
             * @return void
             */
            public function to_json() {
                parent::to_json();
                $this->json[ 'endpoint' ] = $this->endpoint;
                $this->json[ 'purpose' ] = $this->purpose;
            }
        }
        Async_Multiselect::set_control_type( 'async-multiselect' );
    }