<?php

namespace Layerdrops\Ostech\Widgets;


class MainSlider extends \Elementor\Widget_Base
{
    public function get_name()
    {
        return 'ostech-main-slider';
    }

    public function get_title()
    {
        return __('Main Slider', 'ostech-addon');
    }

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

    public function get_categories()
    {
        return ['ostech-category'];
    }

    protected function register_controls()
    {
        $this->start_controls_section(
            'layout_section',
            [
                'label' => __('Layout', 'ostech-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'layout_type',
            [
                'label' => __('Select Layout', 'ostech-addon'),
                'type' => \Elementor\Controls_Manager::SELECT2,
                'default' => 'layout_one',
                'options' => [
                    'layout_one' => __('Layout One', 'ostech-addon'),
                    'layout_two' => __('Layout Two', 'ostech-addon'),
                    'layout_three' => __('Layout Three', 'ostech-addon'),
                    // 'layout_four' => __('Layout Four', 'ostech-addon'),
                    // 'layout_five' => __('Layout Five', 'ostech-addon'),
                ]
            ]
        );


        $this->end_controls_section();

        include ostech_get_elementor_option('main-slider-one-option.php');
        include ostech_get_elementor_option('main-slider-two-option.php');
        include ostech_get_elementor_option('main-slider-three-option.php');
        include ostech_get_elementor_option('main-slider-four-option.php');
        include ostech_get_elementor_option('main-slider-five-option.php');

        //General style
        $this->start_controls_section(
            'general_style',
            [
                'label' => esc_html__('Content Style', 'ostech-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_STYLE,
            ]
        );

        ostech_elementor_general_style_options($this, 'Title', '{{WRAPPER}} .main-slider-one__title, {{WRAPPER}} .main-slider-two__title, {{WRAPPER}} .main-slider-three__title,{{WRAPPER}} .main-slider-four__title,{{WRAPPER}} .main-slider-five__title', ['layout_one', 'layout_two', 'layout_three', 'layout_four', 'layout_five']);
        ostech_elementor_general_style_options($this, 'Sub Title', '{{WRAPPER}} .main-slider-one__sub-title, {{WRAPPER}} .main-slider-two__sub-title, {{WRAPPER}} .main-slider-three__sub-title,{{WRAPPER}} .main-slider-four__sub-title,{{WRAPPER}} .main-slider-five__sub-title', ['layout_one', 'layout_two', 'layout_four', 'layout_five']);
        ostech_elementor_general_style_options($this, 'Summary', '{{WRAPPER}} .main-slider-three__text', ['layout_three']);

        $this->end_controls_section();

        //button style
        $this->start_controls_section(
            'button_style',
            [
                'label' => esc_html__('Button Style', 'ostech-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_STYLE,
            ]
        );

        ostech_elementor_button_style_options($this, 'Button', '{{WRAPPER}} .ostech-btn,{{WRAPPER}} .ostech-btn--icon', '{{WRAPPER}} .ostech-btn::after,{{WRAPPER}} .ostech-btn::before', ['layout_one', 'layout_two', 'layout_three', 'layout_four', 'layout_five']);

        ostech_elementor_button_style_options($this, 'Button Two', '{{WRAPPER}} .ostech-btn--secondary', '{{WRAPPER}} .ostech-btn--secondary::after,{{WRAPPER}} .ostech-btn--secondary::before', ['layout_two']);

        $this->end_controls_section();

        ostech_get_elementor_carousel_options($this, ['layout_one', 'layout_two', 'layout_four', 'layout_five']);
    }

    protected function render()
    {
        $settings = $this->get_settings_for_display();
        include ostech_get_template('main-slider-one.php');
        include ostech_get_template('main-slider-two.php');
        include ostech_get_template('main-slider-three.php');
        include ostech_get_template('main-slider-four.php');
        include ostech_get_template('main-slider-five.php');
    }
}
