<?php

namespace Layerdrops\Ostech\Widgets;


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

	public function get_title()
	{
		return __('FAQ', '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('faq-one-option.php');
		include ostech_get_elementor_option('faq-two-option.php');
		include ostech_get_elementor_option('faq-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, 'Section Title', '{{WRAPPER}} .faq-page__contact__title,{{WRAPPER}} .sec-title__tagline', ['layout_one', 'layout_two']);
		ostech_elementor_general_style_options($this, 'Section Sub Title', '{{WRAPPER}} .faq-page__contact__title,{{WRAPPER}} .sec-title__title', ['layout_one', 'layout_two']);
		ostech_elementor_general_style_options($this, 'Contact Info', '{{WRAPPER}} .faq-page__contact__number', ['layout_one']);


		ostech_elementor_general_style_options($this, 'Question', '{{WRAPPER}} .faq-page__accordion .accrodion-title h4', ['layout_one', 'layout_two', 'layout_three']);
		ostech_elementor_general_style_options($this, 'Answer', '{{WRAPPER}} .faq-page__accordion .accrodion-content p', ['layout_one', 'layout_two', 'layout_three']);

		ostech_elementor_general_style_options($this, 'Count', '{{WRAPPER}} .faqs-two__item__funfact__item__count', ['layout_one']);

		ostech_elementor_general_style_options($this, 'Count Text', '{{WRAPPER}} .faqs-two__item__funfact__item__count', ['layout_one']);

		ostech_elementor_general_style_options($this, 'Counter Bg Color', '{{WRAPPER}} .faqs-two__item__funfact__item', ['layout_one'], 'background-color', false);

		$this->end_controls_section();
	}

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