<?php
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Repeater;
use Elementor\Scheme_Color;
use Elementor\Group_Control_Typography;
Use Elementor\Core\Schemes\Typography;
use Elementor\Group_Control_Border;
use Elementor\Utils;
use Elementor\Group_Control_Text_Shadow;

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

class Widgetkit_Pro_Woo_Single_Product_Thumbnail extends Widget_Base
{

    public function get_name()
    {
        return 'widgetkit-pro-woo-single-product-thumbnail';
    }

    public function get_title()
    {
        return __('Thumbnail', 'widgetkit-pro');
    }

    public function get_icon()
    {
        return 'eicon-woocommerce';
    }

    public function get_categories()
    {
        return ['widgetkit_pro_woo_single_product'];
    }

    /**
	 * A list of style that the widgets is depended in
	 **/
	public function get_style_depends() {
        return [
            'widgetkit_bs',
            'widgetkit_pro_default',
        ];
    }
	/**
	 * A list of scripts that the widgets is depended in
	 **/
	public function get_script_depends() {
		return [ 
			// 'layout',
		 ];
	}

    protected function register_controls()
    {
        

// # region content tab
        /**
         * Layout 
         */
        $this->start_controls_section(
            'section_control_layout',
            [
                'label' => __('Layout', 'widgetkit-pro'),
            ]
        );
            
            $this->add_control(
                'gallery_column',
                [
                    'label'   => __( 'Column', 'widgetkit-pro' ),
                    'type'    => Controls_Manager::NUMBER,
                    'default' => 3,
                    'min'     => 1,
                    'max'     => 12,
                    'step'    => 1,
                ]
            );
            
            $this->add_control(
                'gallery_gap',
                [
                    'label' => __( 'Gallery Gap', 'widgetkit-pro' ),
                    'type' => Controls_Manager::SLIDER,
                    'default' => [
                        'size' => 10,
                    ],
                    'range' => [
                        'px' => [
                            'min' => 0,
                            'max' => 50,
                            'step' => 1,
                        ],
                    ],
                    'size_units' => [ 'px' ],
                    'selectors' => [
                        '{{WRAPPER}} .woo-single-product-thumbnail .product-gallery' => 'grid-gap: {{SIZE}}{{UNIT}}',
                        '{{WRAPPER}} .woo-single-product-thumbnail .product-featured-image' => 'margin-bottom: {{SIZE}}{{UNIT}}',
                    ],
                ]
            );
        $this->end_controls_section();
// #endregion        

    }


    protected function render()
    {
        $settings = $this->get_settings();
        $gallery_column = widgetkit_pro_array_get($settings, 'gallery_column');
        ?>

        <div id="woo-single-product-thumbnail<?php echo $this->get_id(); ?>" class="woo-single-product-thumbnail woo-single-product-thumbnail-<?php echo $this->get_id() ?>">

            <?php 
            include( plugin_dir_path( __FILE__ ) . '../layout/woo/single-product/thumbnail.php'); 
            // if($cat_query_type === 'specific_cat'){
            // }else{
            //     include( plugin_dir_path( __FILE__ ) . '../layout/woo/category/all-category.php'); 
            // }
            ?>
        </div>
        <script>
            jQuery(function($){
                if(!$('body').hasClass('wkpro-woo-single-product-thumbnail')){
                    $('body').addClass('wkpro-woo-single-product-thumbnail');
                }
            });
        </script>

    <?php
    }
    protected function _content_template()
    {
    }
}
