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

use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;

class EventfulForElementorStyleEventMeta
{
    public static function ppfe_style_event_meta_options($widget)
    {
        // Event Meta.
        $widget->start_controls_section(
            'section_grid_event_meta_style',
            [
                'label'     => esc_html__('Event Meta', 'eventful-for-elementor'),
                'tab'       => \Elementor\Controls_Manager::TAB_STYLE,
                'condition' => [
                    'show_event_meta' => 'yes',
                ],
            ]
        );

        // Event Meta typography.
        $widget->add_group_control(
            \Elementor\Group_Control_Typography::get_type(),
            [
                'name'     => 'grid_event_meta_style_typography',
                'global' => [
                    'default' => Global_Typography::TYPOGRAPHY_TEXT,
                ],
                'selector'  => '{{WRAPPER}} .eventful .eventful__item .eventful__item--meta ul li',
                'fields_options' => [
                    'font_size' => [
                        'default' => [
                            'size' => 14,
                            'unit' => 'px',
                        ],
                    ],
                ],
            ]
        );

        // Event Meta color.
        $widget->add_control(
            'grid_event_meta_style_color',
            [
                'type'      => \Elementor\Controls_Manager::COLOR,
                'label'     => esc_html__('Color', 'eventful-for-elementor'),
                'default' => '#888',
                'selectors' => [
                    '{{WRAPPER}} .eventful .eventful__item .eventful__item--meta.event_meta ul li' => 'color: {{VALUE}};',
                    '{{WRAPPER}} .eventful .eventful__item .eventful__item--meta.event_meta ul li a' => 'color: {{VALUE}};',
                ],
            ]
        );

        // Event Meta margin.
        $widget->add_responsive_control(
            'grid_event_meta_style_margin',
            [
                'label'      => esc_html__('Margin', 'eventful-for-elementor'),
                'type'       => \Elementor\Controls_Manager::DIMENSIONS,
                'size_units' => ['px'],
                'default' => [
					'top' => 0,
					'right' => 0,
					'bottom' => 10,
					'left' => 0,
					'unit' => 'px',
					'isLinked' => false,
				],
                'selectors'  => [
                    '{{WRAPPER}} .eventful .eventful__item .eventful__item--meta.event_meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                ],
            ]
        );

        $widget->end_controls_section();
    }
}
