<?php

// Prevent Direct Access
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

new \Kirki\Section( 'main_section', array(
	'title'          => esc_html__('Main Section', 'maxo-fa'),
	'priority'       => 20,
	'description'    => '1. '.esc_html__('To have fixed image and text, set section background image and create one slide without image.', 'maxo-fa').'<br>
						 2. '.esc_html__('To have fixed image and texts slider, set section background image and create multiple slides without image.', 'maxo-fa').'<br>
						 3. '.esc_html__('To have both images and texts slider, create multiple slides with image for each slide.', 'maxo-fa')
) );

// Background Image
new \Kirki\Field\Image( array(
	'settings'    => 'main_background',
	'label'       => esc_html__('Section Background Image', 'maxo-fa'),
	'section'     => 'main_section',
	'choices'     => array(
		'save_as' => 'id',
	),
) );

// Background Video
new \Kirki\Field\Upload( array(
	'settings'    => 'main_video',
	'label'       => esc_html__('Background Video', 'maxo-fa'),
	'description' => esc_html__('Only mp4, webm and ogg formats are accepted.', 'maxo-fa'),
	'section'     => 'main_section',
) );

// Text Color
new \Kirki\Field\Radio_Buttonset( array(
	'settings'    => 'main_text_color',
	'label'       => esc_html__('Texts Color', 'maxo-fa'),
	'section'     => 'main_section',
	'default'     => 'white',
	'choices'     => array(
		'white' => esc_html__('Light', 'maxo-fa'),
		'dark' => esc_html__('Dark', 'maxo-fa'),
	),
) );

// Slides
new \Kirki\Field\Repeater( array(
	'label'       => esc_html__('Slides', 'maxo-fa'),
	'section'     => 'main_section',
	'row_label'   => array(
		'type' => 'text',
		'value' => esc_html__('Slide', 'maxo-fa'),
	),
	'button_label' => esc_html__('Add New Slide', 'maxo-fa'),
	'settings'     => 'main_slides',
	'default'      => array(),
	'fields' => array(
		'background' => array(
			'type'        => 'image',
			'label'       => esc_html__('Background Image', 'maxo-fa'),
			'choices'     => array(
				'save_as' => 'id',
			),
		),

		'texts' => array(
			'type'        => 'custom',
			'label'       => esc_html__('Texts', 'maxo-fa'),
			'description' => esc_html__('To hide any of the texts, set it empty.', 'maxo-fa'),
		),

		'top_text' => array(
			'type'        => 'text',
			'label'       => esc_html__('Top Text', 'maxo-fa'),
		),
		'bottom_text' => array(
			'type'        => 'textarea',
			'label'       => esc_html__('Bottom Text', 'maxo-fa'),
		),
		
		'content_side' => array(
			'type'        => 'radio',
			'label'       => esc_html__('Content Position', 'maxo-fa'),
			'default'     => 'center',
			'choices'     => array(
				'right' => is_rtl() ? esc_html__('Right', 'maxo-fa') : esc_html__('Left', 'maxo-fa'),
				'center' => esc_html__('Center', 'maxo-fa'),
				'left' => is_rtl() ? esc_html__('Left', 'maxo-fa') : esc_html__('Right', 'maxo-fa'),
			),
		),

		'buttons' => array(
			'type'        => 'custom',
			'label'       => esc_html__('Buttons', 'maxo-fa'),
			'description' => esc_html__('To hide any of the buttons, set its text empty.', 'maxo-fa'),
		),

		'button_1_title' => array(
			'type'        => 'custom',
			'label'       => esc_html__('Button 1', 'maxo-fa'),
		),
		'button_1_color' => array(
			'type'        => 'radio',
			'label'       => esc_html__('Color', 'maxo-fa'),
			'default'     => 'color',
			'choices'     => array(
				'color' => esc_html__('Colorful', 'maxo-fa'),
				'border' => esc_html__('Bordered', 'maxo-fa'),
			),
		),
		'button_1_text' => array(
			'type'        => 'text',
			'label'       => esc_html__('Text', 'maxo-fa'),
		),
		'button_1_link' => array(
			'type'        => 'text',
			'label'       => esc_html__('Link', 'maxo-fa'),
		),

		'button_2_title' => array(
			'type'        => 'custom',
			'label'       => esc_html__('Button 2', 'maxo-fa'),
		),
		'button_2_color' => array(
			'type'        => 'radio',
			'label'       => esc_html__('Color', 'maxo-fa'),
			'default'     => 'border',
			'choices'     => array(
				'color' => esc_html__('Colorful', 'maxo-fa'),
				'border' => esc_html__('Bordered', 'maxo-fa'),
			),
		),
		'button_2_text' => array(
			'type'        => 'text',
			'label'       => esc_html__('Text', 'maxo-fa'),
		),
		'button_2_link' => array(
			'type'        => 'text',
			'label'       => esc_html__('Link', 'maxo-fa'),
		),
	)
) );
