<?php

namespace Layerdrops\Ostech\Widgets;


class Service extends \Elementor\Widget_Base
{
    public function get_name()
    {
        return 'ostech-service';
    }

    public function get_title()
    {
        return __('Service', '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'),
                    'layout_six' => __('Layout Six', 'ostech-addon'),
                    'layout_seven' => __('Layout Seven', 'ostech-addon'),
                ]
            ]
        );


        $this->end_controls_section();

        include ostech_get_elementor_option('service-one-option.php');
        include ostech_get_elementor_option('service-two-option.php');
        include ostech_get_elementor_option('service-three-option.php');
        include ostech_get_elementor_option('service-four-option.php');
        include ostech_get_elementor_option('service-five-option.php');
        // include ostech_get_elementor_option('service-six-option.php');
        // include ostech_get_elementor_option('service-seven-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, 'Section Title', '{{WRAPPER}} .sec-title__title,{{WRAPPER}} .sec-title-two__title,{{WRAPPER}} .sec-title-two__title', ['layout_two', 'layout_three', 'layout_five', 'layout_seven']);
        ostech_elementor_general_style_options($this, 'Section Sub Title', '{{WRAPPER}} .sec-title__tagline,{{WRAPPER}} .sec-title-two__tagline,{{WRAPPER}} .sec-title-two__tagline', ['layout_two', 'layout_three', 'layout_five', 'layout_seven']);
        ostech_elementor_general_style_options($this, 'Section Summary', '{{WRAPPER}} .sec-title__tagline,{{WRAPPER}} .service-four__content__text,{{WRAPPER}} .service-five__text', ['layout_two', 'layout_five', 'layout_seven']);

        ostech_elementor_general_style_options($this, 'Service Title', '{{WRAPPER}} .service-one__item__title a,{{WRAPPER}} .service-card-two__title,{{WRAPPER}} .service-three__item__title,{{WRAPPER}} .feature-one__item__title,{{WRAPPER}} .service-card-five__front__title,{{WRAPPER}} .service-two__text,{{WRAPPER}} .service-card__title', ['layout_one', 'layout_two', 'layout_three', 'layout_four', 'layout_six', 'layout_five', 'layout_seven', 'layout_six']);

        ostech_elementor_general_style_options($this, 'Service Summary', '{{WRAPPER}} .service-one__item__text,{{WRAPPER}} .feature-one__item__text,{{WRAPPER}} .service-two__item__content__text', ['layout_one', 'layout_four', 'layout_five']);

        ostech_elementor_general_style_options($this, 'Icon Color', '{{WRAPPER}} .service-card-two__icon,{{WRAPPER}} .service-three__item__icon__inner,{{WRAPPER}} .feature-one__item__icon,{{WRAPPER}} .service-two__item__content__icon,{{WRAPPER}} .service-card__icon', ['layout_two', 'layout_three', 'layout_four', 'layout_five', 'layout_six']);

        ostech_elementor_general_style_options($this, 'Icon Bg Color', '{{WRAPPER}} .service-card-two__icon,{{WRAPPER}} .service-three__item__icon__inner,{{WRAPPER}} .feature-one__item__icon,{{WRAPPER}} .service-two__item__content__icon,{{WRAPPER}} .service-card__icon', ['layout_two', 'layout_three', 'layout_four', 'layout_five', 'layout_six'], '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', 'layout_two', 'layout_six']
                ]
            ]
        );

        ostech_elementor_button_style_options($this, 'Button', '{{WRAPPER}} .service-card-two__link,{{WRAPPER}} .ostech-btn--base::before', '{{WRAPPER}} .service-card-two__link:hover,{{WRAPPER}} .ostech-btn--base:hover', ['layout_one', 'layout_two', 'layout_three', 'layout_four', 'layout_five']);

        $this->end_controls_section();

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

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