<?php

namespace Elementor;

if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly


class Rivax_Dark_Mode_Switcher_Widget extends Widget_Base {

    public function get_name() {
        return 'rivax-dark-mode-switcher';
    }

    public function get_title() {
        return esc_html__('Dark Mode Switcher', 'newsfy');
    }

    public function get_icon() {
        return 'eicon-dark-mode rivax-e-icon';
    }

    protected function get_html_wrapper_class() {
        return $this->get_name() . '-widget';
    }

    public function get_categories() {
        return ['rivax-elements'];
    }

    protected function register_controls()
    {

        $this->start_controls_section(
            'section_general',
            [
                'label' => esc_html__( 'General', 'newsfy' ),
            ]
        );

        $this->end_controls_section();



        $this->start_controls_section(
            'section_style_general',
            [
                'label' => esc_html__( 'General', 'newsfy' ),
                'tab' => Controls_Manager::TAB_STYLE,
            ]
        );

	    $this->add_control('color',
		    [
			    'label' => esc_html__('Color', 'newsfy'),
			    'type' => Controls_Manager::COLOR,
			    'selectors' => [
				    '{{WRAPPER}} .switcher-wrap' => 'color: {{VALUE}};',
			    ],
		    ]);

	    $this->add_control('color_dark_mode',
		    [
			    'label' => esc_html__('Color - Dark Mode', 'newsfy'),
			    'type' => Controls_Manager::COLOR,
			    'selectors' => [
				    'html[scheme="dark"] {{WRAPPER}} .switcher-wrap' => 'color: {{VALUE}};',
			    ],
		    ]);

	    $this->add_control(
		    'size',
		    [
			    'label'     => esc_html__( 'Size', 'newsfy' ),
			    'type'      => Controls_Manager::SLIDER,
			    'selectors' => [
				    '{{WRAPPER}} .switcher-wrap' => 'font-size: {{SIZE}}{{UNIT}};',
			    ],
		    ]
	    );

        $this->end_controls_section();
    }

    protected function render()
    {
        $settings = $this->get_settings_for_display();

        $widget_path_name = str_replace('rivax-', '', $this->get_name() );
        include RIVAX_THEME_DIR . '/elementor/templates/' . $widget_path_name . '/' . $widget_path_name . '.php';
    }

}