<?php
namespace ThemeAtelier\EventfulForElementor\Admin\Widgets\Options;

class EventfulForElementorCarousel
{

    /**
     * Content Carousel Options.
     */
    public static function ppfe_content_carousel_options($widget)
    {
        $widget->start_controls_section(
            'section_carousel',
            [
                'label' => esc_html__('Carousel', 'eventful-for-elementor'),
            ]
        );

        $widget->add_control(
            'carousel_mode',
            [
                'label' => esc_html__('Carousel Mode', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'standard' => esc_html__('Standard', 'eventful-for-elementor'),
                    'center' => esc_html__('Center', 'eventful-for-elementor'),
                    'ticker' => esc_html__('Ticker', 'eventful-for-elementor'),
                ],
                'default' => 'standard',
                'separator' => 'after',
            ]
        );

        // Columns margin.
        $widget->add_control(
            'carousel_style_columns_margin',
            [
                'label'     => esc_html__('Columns margin', 'eventful-for-elementor'),
                'type'      => \Elementor\Controls_Manager::SLIDER,
                'default'   => [
                    'size' => 15,
                ],
                'range'     => [
                    'px' => [
                        'min' => 0,
                        'max' => 100,
                    ],
                ],
                'selectors' => [
                    '{{WRAPPER}} .eventful .ta-efpe-carousel.swiper-fade .swiper-slide:not(:last-child)' => 'gap: {{SIZE}}{{UNIT}}',
                    '{{WRAPPER}} .eventful .ta-efpe-carousel.swiper-cube .swiper-slide:not(:last-child)' => 'gap: {{SIZE}}{{UNIT}}',
                    '{{WRAPPER}} .eventful .ta-efpe-carousel.swiper-flip .swiper-slide:not(:last-child)' => 'gap: {{SIZE}}{{UNIT}}',
                    '{{WRAPPER}} .efpe-carousel-wrapper .swiper-container-cube .swiper-slide' => 'gap: {{SIZE}}{{UNIT}}',
                    '{{WRAPPER}} .efpe-carousel-wrapper .swiper-container-fade .swiper-slide' => 'gap: {{SIZE}}{{UNIT}}',
                    '{{WRAPPER}} .efpe-carousel-wrapper .swiper-container-flip .swiper-slide' => 'gap: {{SIZE}}{{UNIT}}',
                ],
            ]
        );

        $widget->add_control(
            'auto_play',
            [
                'label' => esc_html__('AutoPlay', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Yes', 'eventful-for-elementor'),
                'label_off' => esc_html__('No', 'eventful-for-elementor'),
                'default' => 'yes',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'autoplay_speed',
            [
                'label' => esc_html__('AutoPlay Speed', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '2000',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'carousel_speed',
            [
                'label' => esc_html__('Carousel Speed', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '600',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'ticker_speed',
            [
                'label' => esc_html__('Ticker Speed', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '3000',
                'min'   => 0,
                'step'  => 100,
                'condition' => [
                    'carousel_mode' => ['ticker'],
                ],
            ]
        );

        $widget->add_control(
            'ticker_column_width',
            [
                'label' => esc_html__('Column width', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '400',
                'min'   => 0,
                'max'   => 1000,
                'step'  => 10,
                'condition' => [
                    'carousel_mode' => ['ticker'],
                ],
            ]
        );

        $widget->add_control(
            'pause_hover',
            [
                'label' => esc_html__('Pause on Hover', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Yes', 'eventful-for-elementor'),
                'label_off' => esc_html__('No', 'eventful-for-elementor'),
            ]
        );

        $widget->add_control(
            'infinite_loop',
            [
                'label' => esc_html__('Infinite Loop', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Yes', 'eventful-for-elementor'),
                'label_off' => esc_html__('No', 'eventful-for-elementor'),
                'default' => 'yes',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'lazy_load',
            [
                'label' => esc_html__('Lazy Load', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Yes', 'eventful-for-elementor'),
                'label_off' => esc_html__('No', 'eventful-for-elementor'),
                'default' => 'yes',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'carousel_direction',
            [
                'label' => esc_html__('Carousel Direction', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'rtl' => esc_html__('Right To Left', 'eventful-for-elementor'),
                    'ltr' => esc_html__('Left To Right', 'eventful-for-elementor'),
                ],
                'default' => 'ltr',
            ]
        );

        $widget->add_control(
            'transition_effect',
            [
                'label' => esc_html__('Transition Effect', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'slide' => esc_html__('Slide', 'eventful-for-elementor'),
                    'fade' => esc_html__('Fade', 'eventful-for-elementor'),
                    'coverflow' => esc_html__('Coverflow', 'eventful-for-elementor'),
                    'cube' => esc_html__('Cube', 'eventful-for-elementor'),
                    'flip' => esc_html__('Flip', 'eventful-for-elementor'),
                ],
                'default' => 'slide',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'carousel_column',
            [
                'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE,
                'label' => esc_html__('Column', 'eventful-for-elementor'),
                'label_off' => esc_html__('Default', 'eventful-for-elementor'),
                'label_on' => esc_html__('Custom', 'eventful-for-elementor'),
                'return_value' => 'yes',
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->start_popover();
        $widget->add_control(
            'column_lg_desktop',
            [
                'label' => esc_html__('Large desktop', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '4',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'column_desktop',
            [
                'label' => esc_html__('Desktop', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '3',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'column_tablet',
            [
                'label' => esc_html__('Tablet', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '2',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'column_mobile_landscape',
            [
                'label' => esc_html__('Mobile Landscape', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'column_mobile',
            [
                'label' => esc_html__('Mobile', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );
        $widget->end_popover();

        // Row
        $widget->add_control(
            'carousel_row',
            [
                'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE,
                'label' => esc_html__('Row', 'eventful-for-elementor'),
                'label_off' => esc_html__('Default', 'eventful-for-elementor'),
                'label_on' => esc_html__('Custom', 'eventful-for-elementor'),
                'return_value' => 'yes',
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );
        $widget->start_popover();

        $widget->add_control(
            'row_lg_desktop',
            [
                'label' => esc_html__('Large desktop', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'row_desktop',
            [
                'label' => esc_html__('Desktop', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'row_tablet',
            [
                'label' => esc_html__('Tablet', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'row_mobile_landscape',
            [
                'label' => esc_html__('Mobile Landscape', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'row_mobile',
            [
                'label' => esc_html__('Mobile', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );
        $widget->end_popover();

        $widget->add_control(
            'navigation_options',
            [
                'label' => esc_html__('Navigation', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::HEADING,
                'separator' => 'before',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'navigation',
            [
                'label' => esc_html__('Navigation visibility', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'show' => esc_html__('Show', 'eventful-for-elementor'),
                    'hide' => esc_html__('Hide', 'eventful-for-elementor'),
                    'hide_on_mobile' => esc_html__('Hide on Mobile', 'eventful-for-elementor'),
                ],
                'default' => 'show',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'pagination_options',
            [
                'label' => esc_html__('Pagination', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::HEADING,
                'separator' => 'before',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'pagination',
            [
                'label' => esc_html__('Pagination visibility', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'show' => esc_html__('Show', 'eventful-for-elementor'),
                    'hide' => esc_html__('Hide', 'eventful-for-elementor'),
                    'hide_on_mobile' => esc_html__('Hide on Mobile', 'eventful-for-elementor'),
                ],
                'default' => 'show',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'bullet_types',
            [
                'label' => esc_html__('Pagination Type', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'dots' => 'Dots',
                    'number' => 'Number',
                ],
                'default' => 'dots',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        // Dynamic pagination
        $widget->add_control(
            'dynamic_pagination',
            [
                'label' => esc_html__('Dynamic pagination', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Yes', 'eventful-for-elementor'),
                'label_off' => esc_html__('No', 'eventful-for-elementor'),
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        // Slides to scroll
        $widget->add_control(
            'carousel_slides_to_scroll',
            [
                'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE,
                'label' => esc_html__('Slides to scroll', 'eventful-for-elementor'),
                'label_off' => esc_html__('Default', 'eventful-for-elementor'),
                'label_on' => esc_html__('Custom', 'eventful-for-elementor'),
                'return_value' => 'yes',
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->start_popover();
        $widget->add_control(
            'slides_to_scroll_lg_desktop',
            [
                'label' => esc_html__('Large desktop', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'slides_to_scroll_desktop',
            [
                'label' => esc_html__('Desktop', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'slides_to_scroll_tablet',
            [
                'label' => esc_html__('Tablet', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'slides_to_scroll_mobile_landscape',
            [
                'label' => esc_html__('Mobile Landscape', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );

        $widget->add_control(
            'slides_to_scroll_mobile',
            [
                'label' => esc_html__('Mobile', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => '1',
                'min'        => '1',
                'frontend_available' => true,
                'condition' => [
                    'carousel_mode' => 'standard',
                ],
            ]
        );
        $widget->end_popover();

        $widget->add_control(
            'carousel_additional_options',
            [
                'label' => esc_html__('Additional Options', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::HEADING,
                'separator' => 'before',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'adaptive_height',
            [
                'label' => esc_html__('Adaptive Carousel Height', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Yes', 'eventful-for-elementor'),
                'label_off' => esc_html__('No', 'eventful-for-elementor'),
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'ppfe_accessibility',
            [
                'label' => esc_html__('Tab and Key Navigation', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Yes', 'eventful-for-elementor'),
                'label_off' => esc_html__('No', 'eventful-for-elementor'),
                'default'   => 'yes',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'touch_swipe',
            [
                'label' => esc_html__('Touch Swipe', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Yes', 'eventful-for-elementor'),
                'label_off' => esc_html__('No', 'eventful-for-elementor'),
                'default'   => 'yes',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'slider_draggable',
            [
                'label' => esc_html__('Mouse Draggable', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Yes', 'eventful-for-elementor'),
                'label_off' => esc_html__('No', 'eventful-for-elementor'),
                'default'   => 'yes',
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );

        $widget->add_control(
            'slider_mouse_wheel',
            [
                'label' => esc_html__('Mouse Wheel', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Yes', 'eventful-for-elementor'),
                'label_off' => esc_html__('No', 'eventful-for-elementor'),
                'condition' => [
                    'carousel_mode' => ['standard', 'center'],
                ],
            ]
        );
        $widget->end_controls_section();
    }
}
