<?php
/**
 * Customizer fields for 404 not-found page settings.
 *
 * @package Eronex
 * @since   0.0.1
 */

use Kirki\Field\Dimensions;
use Kirki\Field\Image;
use Kirki\Field\Select;
use Kirki\Field\Text;
use Kirki\Field\Textarea;
use Kirki\Pro\Field\Divider;
use Kirki\Pro\Field\HeadlineToggle;

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

new HeadlineToggle(
	array(
		'label'    => esc_html__( 'Banner', 'eronex' ),
		'settings' => 'eronex_not_found_banner_enable',
		'section'  => 'eronex_not_found',
		'default'  => true,
		array(
			'setting'  => 'eronex_banner_enable',
			'operator' => '===',
			'value'    => true,
		),
	)
);

new Image(
	array(
		'label'           => esc_html__( 'Background Image', 'eronex' ),
		'settings'        => 'eronex_not_found_banner_bg',
		'section'         => 'eronex_not_found',
		'transport'       => 'auto',
		'output'          => array(
			array(
				'element' => 'body.error404 .eronex-banner',
				'property' => 'background-image',
			),
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_banner_enable',
				'operator' => '===',
				'value'    => true,
			),
			array(
				'setting'  => 'eronex_not_found_banner_enable',
				'operator' => '===',
				'value'    => true,
			),
		),
	)
);

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

new Select(
	array(
		'label'    => esc_html__( 'Container Layout', 'eronex' ),
		'settings' => 'eronex_not_found_container_layout',
		'section'  => 'eronex_not_found',
		'default'  => '',
		'choices'  => array(
			''                => esc_html__( 'Default', 'eronex' ),
			'container'       => esc_html__( 'Normal', 'eronex' ),
			'container-fluid' => esc_html__( 'Fluid', 'eronex' ),
			'full-width'      => esc_html__( 'Full Width', 'eronex' ),
		),
	)
);

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

new Dimensions(
	array(
		'settings'   => 'eronex_not_found_content_padding',
		'label'      => esc_html__( 'Content Padding', 'eronex' ),
		'section'    => 'eronex_not_found',
		'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'     => 'body.error404 .eronex-content-inner',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
		'transport'  => 'auto',
		'responsive' => true,
	)
);

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

new Image(
	array(
		'label'    => esc_html__( 'Image', 'eronex' ),
		'settings' => 'eronex_not_found_image',
		'section'  => 'eronex_not_found',
		'default'  => ERONEX_URI . 'assets/img/404.png',
	)
);

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

new Text(
	array(
		'settings' => 'eronex_not_found_title',
		'label'    => esc_html__( 'Title', 'eronex' ),
		'section'  => 'eronex_not_found',
		'default'  => esc_html__( 'Not found', 'eronex' ),
	)
);

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

new Textarea(
	array(
		'settings' => 'eronex_not_found_description',
		'label'    => esc_html__( 'Description', 'eronex' ),
		'section'  => 'eronex_not_found',
		'default'  => esc_html__( 'Oops! The page you’re looking for doesn’t exist or may have been moved.', 'eronex' ),
	)
);