<?php
/**
 * Adds the header options sections, settings, and controls to the theme customizer
 *
 * @package Weddi_Pro
 */

class Weddi_Pro_Header_Options {
	public function __construct() {
		// Register Header Options.
		add_action( 'customize_register', array( $this, 'register_header_options' ) );
	}

	/**
	 * Add header options section and its controls
	 */
	public function register_header_options( $wp_customize ) {
		// Add header options section.
		$wp_customize->add_section( 'weddi_pro_header_options',
			array(
				'title' => esc_html__( 'Header Options', 'weddi-pro' ),
				'panel' => 'weddi_pro_theme_options'
			)
		);

		Weddi_Pro_Customizer_Utilities::register_option(
			array(
				'type'              => 'text',
				'settings'          => 'weddi_pro_header_email',
				'sanitize_callback' => 'sanitize_email',
				'label'             => esc_html__( 'Email', 'weddi-pro' ),
				'section'           => 'weddi_pro_header_options',
			)
		);

		Weddi_Pro_Customizer_Utilities::register_option(
			array(
				'type'              => 'text',
				'settings'          => 'weddi_pro_header_phone',
				'sanitize_callback' => 'weddi_pro_text_sanitization',
				'label'             => esc_html__( 'Phone', 'weddi-pro' ),
				'section'           => 'weddi_pro_header_options',
			)
		);

		Weddi_Pro_Customizer_Utilities::register_option(
			array(
				'type'              => 'text',
				'settings'          => 'weddi_pro_header_address',
				'sanitize_callback' => 'weddi_pro_text_sanitization',
				'label'             => esc_html__( 'Address', 'weddi-pro' ),
				'section'           => 'weddi_pro_header_options',
			)
		);

		Weddi_Pro_Customizer_Utilities::register_option(
			array(
				'type'              => 'text',
				'settings'          => 'weddi_pro_header_open_hours',
				'sanitize_callback' => 'weddi_pro_text_sanitization',
				'label'             => esc_html__( 'Open Hours', 'weddi-pro' ),
				'section'           => 'weddi_pro_header_options',
			)
		);

		Weddi_Pro_Customizer_Utilities::register_option(
			array(
				'type'              => 'text',
				'settings'          => 'weddi_pro_header_button_text',
				'sanitize_callback' => 'weddi_pro_text_sanitization',
				'label'             => esc_html__( 'Button Text', 'weddi-pro' ),
				'section'           => 'weddi_pro_header_options',
			)
		);

		Weddi_Pro_Customizer_Utilities::register_option(
			array(
				'type'              => 'url',
				'settings'          => 'weddi_pro_header_button_link',
				'sanitize_callback' => 'esc_url_raw',
				'label'             => esc_html__( 'Button Link', 'weddi-pro' ),
				'section'           => 'weddi_pro_header_options',
			)
		);

		Weddi_Pro_Customizer_Utilities::register_option(
			array(
				'custom_control'    => 'Weddi_Pro_Toggle_Switch_Custom_control',
				'settings'          => 'weddi_pro_header_button_target',
				'sanitize_callback' => 'weddi_pro_switch_sanitization',
				'label'             => esc_html__( 'Open link in new tab?', 'weddi-pro' ),
				'section'           => 'weddi_pro_header_options',
			)
		);
	}
}

/**
 * Initialize class
 */
$weddi_pro_theme_options = new Weddi_Pro_Header_Options();
