<?php

namespace Layerdrops\Ostech\Widgets;


class CallToAction extends \Elementor\Widget_Base
{
    public function get_name()
    {
        return 'ostech-call-to-action';
    }

    public function get_title()
    {
        return __('Call To Action', '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'),
                ]
            ]
        );
        $this->end_controls_section();

        include ostech_get_elementor_option('call-to-action-one-option.php');
        include ostech_get_elementor_option('call-to-action-two-option.php');
        // include ostech_get_elementor_option('call-to-action-three-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}} .cta-three__content__title,{{WRAPPER}} .faq-contact__inner__item__subtitle', ['layout_one', 'layout_two']);

        ostech_elementor_general_style_options($this, 'Info', '{{WRAPPER}} .faq-contact__inner__item__contact', ['layout_two']);

        ostech_elementor_general_style_options($this, 'Background Color', '{{WRAPPER}} .cta-three__content,{{WRAPPER}} .faq-contact__inner__item', ['layout_one', 'layout_two'], 'background-color', false);
        $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,
                'condition' => [
                    'layout_type' => ['layout_one']
                ]
            ]
        );

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

        $this->end_controls_section();
    }

    protected function render()
    {
        $settings = $this->get_settings_for_display();
        include ostech_get_template('call-to-action-one.php');
        include ostech_get_template('call-to-action-two.php');
        // include ostech_get_template('call-to-action-three.php');
    }
}
