<?php

/*
Widget Name: Case
Description: Display one or more case depicting a percentage value in a multi-column grid.
Author: ThemesFlat
Author URI: https://www.themesflatthemes.com
*/

namespace ThemesflatAddons\Widgets;

use  Elementor\Widget_Base;
use  Elementor\Controls_Manager;
use  Elementor\Scheme_Color;
use  Elementor\Group_Control_Typography;
use  Elementor\Scheme_Typography;

if (!defined('ABSPATH')) {
    exit;
}

// Exit if accessed directly
class TFL_Case_Widget extends TFL_Widget_Base
{
    public function get_name()
    {
        return 'tfl-case';
    }

    public function get_title()
    {
        return __('Case', 'themesflat');
    }

    public function get_icon()
    {
        return 'tfl-icon-checkbox-unchecked';
    }

    public function get_categories()
    {
        return array('themesflat-addons');
    }

    public function get_custom_help_url()
    {
        return 'https://themesflatelementor.com/docs/themesflat-addons/core-addons/case-addon/';
    }

    public function get_script_depends()
    {
        return ['tfl-waypoints', 'tfl-frontend-scripts'];
    }

    public function get_style_depends()
    {
        return ['tfl-animate-styles', 'tfl-frontend-styles', 'tfl-case-styles'];
    }

    protected function register_controls()
    {
        $this->start_controls_section('section_case', [
            'label' => __('Case', 'themesflat'),
        ]);

        $this->add_control('style', [
            'type' => Controls_Manager::SELECT,
            'label' => __('Choose Style', 'themesflat'),
            'default' => 'style1',
            'options' => [
            'style2' => __( 'Style 2', 'themesflat' ),
            'style1' => __( 'Style 1', 'themesflat' ),
            ],
        ]);

        $this->add_control( 'posts_per_page', [
            'label'     => __( 'Posts Per Page', 'themesflat' ),
            'type'      => Controls_Manager::NUMBER,
            'min'       => 1,
            'max'       => 50,
            'step'      => 1,
            'default'   => 4,
        ] );


        $this->add_control('widget_animation', [
            "type" => Controls_Manager::SELECT,
            "label" => __("Animation Type", "themesflat"),
            'options' => tfl_get_animation_options(),
            'default' => 'none',
        ]);

        $this->end_controls_section();

    }

    protected function render()
    {
        $settings = $this->get_settings_for_display();
        $settings = apply_filters('tfl_case_' . $this->get_id() . '_settings', $settings);
        $args['settings'] = $settings;
        $args['widget_instance'] = $this;
        tfl_get_template_part("addons/case/loop", $args);
    }

    protected function content_template()
    {
    }

}