<?php

/**
 * Control for general settings
 *
 * @package Kubelio\Customizer
 * @since 1.0.0
 */

namespace Kubelio\Customizer;

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

class General {

	use Helper;

	/**
	 * Constructor.
	 */
	public function __construct() {
		add_action('after_setup_theme', array($this, 'register_fields'));
	}

	/**
	 * Register General related customizer fields
	 */
	public function register_fields() {
		$this->set_section();
		$this->add_element();
	}

	/**
	 * Set sections and panels
	 */
	public function set_section() {
		$this->add_panel(
			'general',
			array(
				'title'    => esc_html__('Global', 'kubelio'),
				'priority' => 50,
			)
		);

		$this->add_section(
			'general_menu',
			array(
				'title'    => esc_html__('Sub Menu', 'kubelio'),
				'panel'    => 'general',
				'priority' => 25,
			)
		);

		$this->add_section(
			'general_element',
			array(
				'title'    => esc_html__('Element', 'kubelio'),
				'panel'    => 'general',
				'priority' => 35,
			)
		);
	}

	/**
	 * Add general element fields
	 */
	public function add_element() {
		$section = 'general_element';

		$this->add_field(
			array(
				'type'     => 'toggle',
				'settings' => 'breadcrumbs',
				'label'    => esc_html__('Breadcrumbs', 'kubelio'),
				'default'  => true,
				'section'  => $section,
			)
		);

		$this->add_field(
			array(
				'type'     => 'toggle',
				'settings' => 'gotop',
				'label'    => esc_html__('Go Top Navigation', 'kubelio'),
				'default'  => true,
				'section'  => $section,
			)
		);

		$this->add_field(
			array(
				'type'        => 'select',
				'settings'    => 'mobile_menu_style',
				'label'       => esc_html__('Mobile Menu Style', 'kubelio'),
				'description' => esc_html__('Choose the interaction style for the mobile navigation menu.', 'kubelio'),
				'default'     => 'slidepanel',
				'section'     => $section,
				'choices'     => array(
					'slidepanel' => esc_html__('Slide Panel (Side)', 'kubelio'),
					'dropdown'   => esc_html__('Dropdown (Top)', 'kubelio'),
				),
			)
		);

	}
}
