<?php
pxl_add_custom_widget(
    array(
        'name' => 'pxl_wind_turbine',
        'title' => esc_html__('Case Wind Turbine SVG', 'solarva' ),
        'icon' => 'eicon-accordion',
        'categories' => array('pxltheme-core'),
        'params' => array(
            'sections' => array(
                array(
                    'name' => 'section_content',
                    'label' => esc_html__('Content', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                    'controls' => array(
                        array(
                            'name' => 'wind_turbine_style',
                            'label' => esc_html__('Choose SVG', 'solarva'),
                            'type' => Elementor\Controls_Manager::SELECT,
                            'default' => '1',
                            'options' => [
                                '1' => esc_html__('1', 'solarva'),
                                '2' => esc_html__('2', 'solarva'),
                                '3' => esc_html__('3', 'solarva'),
                            ],
                        ),
                        array(
                            'name' => 'svg_color',
                            'label' => esc_html__('Color', 'solarva'),
                            'type' => Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-wind-turbine svg path' => 'fill: {{VALUE}};',
                                '{{WRAPPER}} .pxl-wind-turbine svg rect' => 'fill: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'svg_opacity',
                            'label' => esc_html__('Opacity', 'solarva'),
                            'type' => Elementor\Controls_Manager::NUMBER,
                            'min' => 0,
                            'max' => 1, 
                            'step' => 0.1,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-wind-turbine svg path' => 'fill-opacity: {{VALUE}};',
                                '{{WRAPPER}} .pxl-wind-turbine svg rect' => 'fill-opacity: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'turbine_blade_duration',
                            'label' => esc_html__('Duration', 'solarva'),
                            'type' => Elementor\Controls_Manager::NUMBER,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-wind-turbine .turbine-blades' => 'animation-duration: {{VALUE}}s;',
                            ],
                        ),
                        array(
                            'name' => 'svg_width',
                            'label' => esc_html__('Width', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 3000,
                                ],
                            ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-wind-turbine svg' => 'width: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'svg_height',
                            'label' => esc_html__('Height', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 3000,
                                ],
                            ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-wind-turbine svg' => 'height: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),
                solarva_widget_animation_settings(),
            ),
        ),
    ),
    solarva_get_class_widget_path()
);