<?php
/**
 * Customizer fields for header layout settings.
 *
 * @package Eronex
 * @since   0.0.1
 */

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

use Kirki\Field\Color;
use Kirki\Field\Dimension;
use Kirki\Field\Select;
use Kirki\Pro\Field\Divider;
use Kirki\Pro\Field\HeadlineToggle;

new Select(
	array(
		'label'    => esc_html__( 'Layout', 'eronex' ),
		'settings' => 'eronex_header_style',
		'section'  => 'eronex_header_layout',
		'default'  => '1',
		'choices'  => array(
			'1' => esc_html__( 'Style 1', 'eronex' ),
			'2' => esc_html__( 'Style 2', 'eronex' ),
			'3' => esc_html__( 'Style 3', 'eronex' ),
			'4' => esc_html__( 'Style 4', 'eronex' ),
			'5' => esc_html__( 'Style 5', 'eronex' ),
		),
	)
);

new Divider(
	array(
		'settings' => 'eronex_header_container_separator',
		'section'  => 'eronex_header_layout',
		'choices'  => array(
			'color' => $separator_color,
		),
	),
);

new Select(
	array(
		'label'    => esc_html__( 'Container', 'eronex' ),
		'settings' => 'eronex_header_container',
		'section'  => 'eronex_header_layout',
		'default'  => 'container',
		'choices'  => array(
			'container'       => esc_html__( 'Container', 'eronex' ),
			'container-fluid' => esc_html__( 'Container Fluid', 'eronex' ),
			'full-width'      => esc_html__( 'Full Width', 'eronex' ),
			'custom-width'    => esc_html__( 'Custom Width', 'eronex' ),
		),
	)
);

new Divider(
	array(
		'settings'        => 'eronex_header_container_width_separator',
		'section'         => 'eronex_header_layout',
		'choices'         => array(
			'color' => $separator_color,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_container',
				'operator' => '===',
				'value'    => 'custom-width',
			),
		),
	),
);

new Dimension(
	array(
		'label'           => esc_html__( 'Custom Width', 'eronex' ),
		'settings'        => 'eronex_header_container_width',
		'section'         => 'eronex_header_layout',
		'transport'       => 'auto',
		'responsive'      => true,
		'default'         => array(
			'desktop' => '1280px',
			'tablet'  => '1140px',
			'mobile'  => '1025px',
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_container',
				'operator' => '===',
				'value'    => 'custom-width',
			),
		),
		'output'          => array(
			array(
				'element'     => 'header.eronex-header .eronex-custom-width',
				'property'    => 'max-width',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
	)
);

new Divider(
	array(
		'settings' => 'eronex_header_height_separator',
		'section'  => 'eronex_header_layout',
		'choices'  => array(
			'color' => $separator_color,
		),
	),
);

new Dimension(
	array(
		'label'           => esc_html__( 'Width', 'eronex' ),
		'settings'        => 'eronex_header_width',
		'section'         => 'eronex_header_layout',
		'transport'       => 'auto',
		'responsive'      => true,
		'default'         => array(
			'desktop' => '',
			'tablet'  => '',
			'mobile'  => '',
		),
		'output'          => array(
			array(
				'element'     => '.eronex-header:not(.eronex-appear) .eronex-navbar-style-5',
				'property'    => 'max-width',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_style',
				'operator' => '===',
				'value'    => '5',
			),
		),
	)
);

new Dimension(
	array(
		'label'      => esc_html__( 'Height', 'eronex' ),
		'settings'   => 'eronex_header_height',
		'section'    => 'eronex_header_layout',
		'transport'  => 'auto',
		'responsive' => true,
		'default'    => array(
			'desktop' => '',
			'tablet'  => '',
			'mobile'  => '',
		),
		'output'     => array(
			array(
				'element'     => 'header.eronex-header .eronex-navbar',
				'property'    => 'height',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
	)
);

new Divider(
	array(
		'settings' => 'eronex_header_transparent_separator',
		'section'  => 'eronex_header_layout',
		'choices'  => array(
			'color' => $separator_color,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_style',
				'operator' => '!==',
				'value'    => '5',
			),
		),
	),
);

new HeadlineToggle(
	array(
		'label'           => esc_html__( 'Transparent', 'eronex' ),
		'settings'        => 'eronex_header_transparent',
		'section'         => 'eronex_header_layout',
		'default'         => false,
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_style',
				'operator' => '!==',
				'value'    => '5',
			),
		),
	)
);

new Divider(
	array(
		'settings' => 'eronex_header_bg_separator',
		'section'  => 'eronex_header_layout',
		'choices'  => array(
			'color' => $separator_color,
		),
	),
);

new Color(
	array(
		'label'           => esc_html__( 'Background Color', 'eronex' ),
		'settings'        => 'eronex_header_bg',
		'section'         => 'eronex_header_layout',
		'default'         => '',
		'transport'       => 'auto',
		'choices'         => array(
			'alpha' => true,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_transparent',
				'operator' => '===',
				'value'    => false,
			),
		),
		'output'          => array(
			array(
				'element'  => '.eronex-navbar:not(.eronex-transparent)',
				'property' => 'background-color',
			),
		),
	)
);

new Color(
	array(
		'label'     => esc_html__( 'Border Color', 'eronex' ),
		'settings'  => 'eronex_header_border_color',
		'section'   => 'eronex_header_layout',
		'default'   => '',
		'transport' => 'auto',
		'choices'   => array(
			'alpha' => true,
		),
		'output'    => array(
			array(
				'element'  => 'header.eronex-header .eronex-navbar',
				'property' => 'border-color',
			),
		),
	)
);

new Divider(
	array(
		'settings' => 'eronex_header_sticky_separator',
		'section'  => 'eronex_header_layout',
		'choices'  => array(
			'color' => $separator_color,
		),
	),
);

new HeadlineToggle(
	array(
		'label'    => esc_html__( 'Sticky', 'eronex' ),
		'settings' => 'eronex_header_sticky',
		'section'  => 'eronex_header_layout',
		'default'  => true,
	)
);

new Divider(
	array(
		'settings'        => 'eronex_sticky_header_effect_separator',
		'section'         => 'eronex_header_layout',
		'choices'         => array(
			'color' => $separator_color,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_sticky',
				'operator' => '==',
				'value'    => true,
			),
		),
	),
);

new Select(
	array(
		'label'           => esc_html__( 'Sticky On', 'eronex' ),
		'settings'        => 'eronex_sticky_header_effect',
		'section'         => 'eronex_header_layout',
		'default'         => 'scroll-down',
		'choices'         => array(
			'scroll-down' => esc_html__( 'Scroll Down', 'eronex' ),
			'scroll-up'   => esc_html__( 'Scroll Up', 'eronex' ),
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_sticky',
				'operator' => '===',
				'value'    => true,
			),
		),
	)
);

new Divider(
	array(
		'settings'        => 'eronex_sticky_header_height_separator',
		'section'         => 'eronex_header_layout',
		'choices'         => array(
			'color' => $separator_color,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_sticky',
				'operator' => '===',
				'value'    => true,
			),
		),
	),
);

new Dimension(
	array(
		'label'           => esc_html__( 'Sticky Height', 'eronex' ),
		'settings'        => 'eronex_sticky_header_height',
		'section'         => 'eronex_header_layout',
		'transport'       => 'auto',
		'responsive'      => true,
		'default'         => array(
			'desktop' => '',
			'tablet'  => '',
			'mobile'  => '',
		),
		'output'          => array(
			array(
				'element'     => 'header.eronex-appear .eronex-navbar',
				'property'    => 'height',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_sticky',
				'operator' => '===',
				'value'    => true,
			),
		),
	)
);

new Divider(
	array(
		'settings'        => 'eronex_sticky_header_bg_separator',
		'section'         => 'eronex_header_layout',
		'choices'         => array(
			'color' => $separator_color,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_sticky',
				'operator' => '===',
				'value'    => true,
			),
		),
	),
);

new Color(
	array(
		'label'           => esc_html__( 'Sticky Background', 'eronex' ),
		'settings'        => 'eronex_sticky_header_bg',
		'section'         => 'eronex_header_layout',
		'default'         => '',
		'transport'       => 'auto',
		'choices'         => array(
			'alpha' => true,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_sticky',
				'operator' => '===',
				'value'    => true,
			),
		),
		'output'          => array(
			array(
				'element'  => 'header.eronex-appear .eronex-navbar',
				'property' => 'background-color',
			),
		),
	)
);

new Color(
	array(
		'label'           => esc_html__( 'Sticky Border', 'eronex' ),
		'settings'        => 'eronex_sticky_header_border_color',
		'section'         => 'eronex_header_layout',
		'default'         => '',
		'transport'       => 'auto',
		'choices'         => array(
			'alpha' => true,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_header_sticky',
				'operator' => '===',
				'value'    => true,
			),
		),
		'output'          => array(
			array(
				'element'  => 'header.eronex-appear .eronex-navbar',
				'property' => 'border-color',
			),
		),
	)
);
