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

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

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

new HeadlineToggle(
	array(
		'label'    => esc_html__( 'Banner', 'eronex' ),
		'settings' => 'eronex_banner_enable',
		'section'  => 'eronex_banner_layout',
		'default'  => true,
	)
);

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

new Select(
	array(
		'label'    => esc_html__( 'Container', 'eronex' ),
		'settings' => 'eronex_banner_container',
		'section'  => 'eronex_banner_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_banner_container_width_separator',
		'section'  => 'eronex_banner_layout',
		'choices'  => array(
			'color' => $separator_color,
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_banner_container',
				'operator' => '==',
				'value'    => 'custom-width',
			),
		),
	),
);

new Dimension(
	array(
		'label'           => esc_html__( 'Container Width', 'eronex' ),
		'settings'        => 'eronex_banner_container_width',
		'section'         => 'eronex_banner_layout',
		'transport'       => 'auto',
		'responsive'      => true,
		'default'         => array(
			'desktop' => '1280px',
			'tablet'  => '1140px',
			'mobile'  => '1025px',
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_banner_container',
				'operator' => '==',
				'value'    => 'custom-width',
			),
		),
		'output'          => array(
			array(
				'element'     => '.eronex-banner > .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_banner_height_separator',
		'section'  => 'eronex_banner_layout',
		'choices'  => array(
			'color' => $separator_color,
		),
	),
);

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

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

new Background(
	array(
		'label'     => esc_html__( 'Background', 'eronex' ),
		'settings'  => 'eronex_banner_bg',
		'section'   => 'eronex_banner_layout',
		'transport' => 'auto',
		'default'   => array(
			'background-color'      => '',
			'background-image'      => '',
			'background-repeat'     => '',
			'background-position'   => '',
			'background-size'       => '',
			'background-attachment' => '',
		),
		'output'    => array(
			array(
				'element' => '.eronex-banner',
			),
		),
	)
);

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

new Color(
	array(
		'label'     => esc_html__( 'Overlay Color', 'eronex' ),
		'settings'  => 'eronex_banner_overlay',
		'section'   => 'eronex_banner_layout',
		'transport' => 'auto',
		'default'   => '',
		'choices'   => array(
			'alpha' => true,
		),
		'output'    => array(
			array(
				'element'  => '.eronex-banner::before',
				'property' => 'background-color',
			),
		),
	)
);

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

new Dimensions(
	array(
		'settings'   => 'eronex_banner_padding',
		'label'      => esc_html__( 'Padding', 'eronex' ),
		'section'    => 'eronex_banner_layout',
		'default'    => array(
			'mobile'  => array(
				'padding-top'    => '',
				'padding-bottom' => '',
			),
			'tablet'  => array(
				'padding-top'    => '',
				'padding-bottom' => '',
			),
			'desktop' => array(
				'padding-top'    => '',
				'padding-bottom' => '',

			),
		),
		'choices'    => array(
			'labels' => array(
				'padding-top'    => esc_html__( 'Top', 'eronex' ),
				'padding-bottom' => esc_html__( 'Bottom', 'eronex' ),
			),
		),
		'output'     => array(
			array(
				'element'     => '.eronex-banner',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
		'transport'  => 'auto',
		'responsive' => true,
	)
);

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

new Dimensions(
	array(
		'settings'   => 'eronex_banner_margin',
		'label'      => esc_html__( 'Margin', 'eronex' ),
		'section'    => 'eronex_banner_layout',
		'default'    => array(
			'mobile'  => array(
				'margin-top'    => '',
				'margin-bottom' => '',
			),
			'tablet'  => array(
				'margin-top'    => '',
				'margin-bottom' => '',
			),
			'desktop' => array(
				'margin-top'    => '',
				'margin-bottom' => '',
			),
		),
		'choices'    => array(
			'labels' => array(
				'margin-top'    => esc_html__( 'Top', 'eronex' ),
				'margin-bottom' => esc_html__( 'Bottom', 'eronex' ),
			),
		),
		'output'     => array(
			array(
				'element'     => '.eronex-banner',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
		'transport'  => 'auto',
		'responsive' => true,
	)
);
