<?php 
/**
 * MAIN NEWS SECTION SETTINGS
 */
Kirki::add_section( 'front_video_section', array(
	'title'    => esc_html__( 'Video News Section', 'newshit' ),
	'panel'    => 'newshit_front_page_options',
) );

Kirki::add_field( 'theme_config', [
	'type'        => 'switch',
	'settings'    => 'enable_video_section',
	'label'       => esc_html__( 'Enable Video Section', 'newshit' ),
	'section'     => 'front_video_section',
	'default'     => 'off',
	'choices'     => [
		'on'  => esc_html__( 'Enable', 'newshit' ),
		'off' => esc_html__( 'Disable', 'newshit' ),
	],
] );

new \Kirki\Field\Text(
	[
		'settings' => 'video_section_title',
		'label'    => esc_html__( 'Section Title', 'newshit' ),
		'section'  => 'front_video_section',
		'default'  => esc_html__( 'Video Gallery', 'newshit' ),
        'active_callback' => [
            [
                'setting'  => 'enable_video_section',
                'operator' => '===',
                'value'    => true,
            ],
        ], 
		'partial_refresh'    => [
			'video_section_title_refresh' => [
				'selector'        => '.newshit-video-section-inner .newshit-section-title-box',
				'render_callback' => 'newshit_customizer_quickedit',
			],
		],
	]
);

Kirki::add_field( 'theme_config', [
	'type'        => 'switch',
	'settings'    => 'enable_video_post_filter',
	'label'       => esc_html__( 'Enable Video Post Filter', 'newshit' ),
	'section'     => 'front_video_section',
	'default'     => 'off',
	'choices'     => [
		'on'  => esc_html__( 'Enable', 'newshit' ),
		'off' => esc_html__( 'Disable', 'newshit' ),
	],
	'active_callback' => [
		[
			'setting'  => 'enable_video_section',
			'operator' => '===',
			'value'    => true,
		],
	], 
] );

new \Kirki\Field\Select(
	[
		'settings'    => 'video_select_filter',
		'label'       => esc_html__( 'Select Category Or Tags', 'newshit' ),
		'section'     => 'front_video_section',
		'default'     => 'one',
		'choices'     => [
			'one' => esc_html__( 'Category', 'newshit' ),
			'two' => esc_html__( 'Tags', 'newshit' ),
		],
		'active_callback' => [
			[
				'setting'  => 'enable_video_section',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_video_post_filter',
				'operator' => '===',
				'value'    => true,
			],
		], 
	]
);

new Kirki\Field\Select(
	[
		'settings'    => 'video_post_cat',
		'label'       => __( 'Select Categroy', 'newshit' ),
		'section'     => 'front_video_section',
		'default'     => '',
		'multiple'    => -1,
		'placeholder' => __( 'Select an Categorys', 'newshit' ),
		'choices'     => Kirki\Util\Helper::get_terms(array('taxonomy' => 'category')),
		'active_callback' => [
			[
				'setting'  => 'video_select_filter',
				'operator' => '===',
				'value'    => 'one',
			],
			[
				'setting'  => 'enable_video_post_filter',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_video_section',
				'operator' => '===',
				'value'    => true,
			],
		], 
	]
);


new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'video_post_tag_pro',
		'label'       => esc_html__( 'Tags Is Pro Featured', 'newshit' ),
		'description' => newshit_purchase_link(),
		'section'     => 'front_video_section',
		'default'     => '',
		'transport'   => 'auto',
		'choices'     => [
			'1'   => get_template_directory_uri() . '/assets/image/pro/tags-pro.jpg',
		],
		'active_callback' => [
			[
				'setting'  => 'video_select_filter',
				'operator' => '===',
				'value'    => 'two',
			],
			[
				'setting'  => 'enable_video_post_filter',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_video_section',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);


new \Kirki\Field\Select(
	[
		'settings'        => 'video_section_order',
		'label'           => esc_html__( 'Post Order', 'newshit' ),
		'section'         => 'front_video_section',
		'default'         => 'ASC',
		'placeholder'     => esc_html__( 'Choose an option', 'newshit' ),
		'choices'         => [
			'ASC'  => esc_html__( 'ASC', 'newshit' ),
			'DESE' => esc_html__( 'DESE', 'newshit' ),
		],
		'active_callback' => [
			[
				'setting'  => 'enable_video_section',
				'operator' => '===',
				'value'    => true,
			],
		], 
	]
);

new \Kirki\Field\Select(
	[
		'settings'        => 'video_section_postby',
		'label'           => esc_html__( 'Post Order By', 'newshit' ),
		'section'         => 'front_video_section',
		'default'         => 'rand',
		'placeholder'     => esc_html__( 'Choose an option', 'newshit' ),
		'choices'         => [
			'none'          => esc_html__( 'None', 'newshit' ),
			'ID'            => esc_html__( 'ID', 'newshit' ),
			'date'          => esc_html__( 'Date', 'newshit' ),
			'name'          => esc_html__( 'Name', 'newshit' ),
			'title'         => esc_html__( 'Title', 'newshit' ),
			'comment_count' => esc_html__( 'Comment count', 'newshit' ),
			'rand'          => esc_html__( 'Random', 'newshit' ),
		],
		'active_callback' => [
			[
				'setting'  => 'enable_video_section',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);

new \Kirki\Field\Number(
	[
		'settings' => 'video_display',
		'label'    => esc_html__( 'Display Item', 'newshit' ),
		'section'  => 'front_video_section',
		'default'  => 6,
		'choices'  => [
			'min'  => 1,
			'max'  => 8,
			'step' => 1,
		],
		'active_callback' => [
			[
				'setting'  => 'enable_video_section',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);
new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'video_display_pro',
		'label'       => esc_html__( 'Purchase Pro for Add Unlimited items', 'newshit' ),
		'description' => newshit_purchase_link(),
		'section'     => 'front_video_section',
		'default'     => '',
		'transport'   => 'auto',
		'active_callback' => [
			[
				'setting'  => 'enable_video_section',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);

new \Kirki\Field\Number(
	[
		'settings' => 'video_title_lanth',
		'label'    => esc_html__( 'Title Length', 'newshit' ),
		'section'  => 'front_video_section',
		'default'  => 10,
		'choices'  => [
			'min'  => 1,
			'max'  => 50,
			'step' => 1,
		],
		'active_callback' => [
			[
				'setting'  => 'enable_video_section',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);


//====================================================
//======== Video ads Section Ads Settings ============
//====================================================

Kirki::add_field( 'theme_config', [
	'type'        => 'switch',
	'settings'    => 'video_ads_enable',
	'label'       => esc_html__( 'Enable Ads Banner', 'newshit' ),
	'description' => esc_html__( 'Enable Ads Banner For Featured Section', 'newshit' ),
	'section'     => 'front_video_section',
	'default'     => 'off',
	'choices'     => [
		'on'  => esc_html__( 'Enable', 'newshit' ),
		'off' => esc_html__( 'Disable', 'newshit' ),
	],
] );



new \Kirki\Field\Select(
	[
		'settings'    => 'video_section_ads_type',
		'label'       => esc_html__( 'Select Ads Type', 'newshit' ),
		'section'     => 'front_video_section',
		'default'     => 'link',
		'active_callback' => [
			[
				'setting'  => 'video_ads_enable',
				'operator' => '===',
				'value'    => true,
			]
		],
		'choices'     => [
			'link' => esc_html__( 'Link', 'newshit' ),
			'code' => esc_html__( 'Code', 'newshit' ),
		],
		'partial_refresh'    => [
			'video_section_ads_type_refresh' => [
				'selector'        => '.newshit-video-section-ads-wrapper',
				'render_callback' => 'newshit_customizer_quickedit',
			],
		],
	]
);

new \Kirki\Field\Image(
	[
		'settings'    => 'video_section_ads_image',
		'label'       => esc_html__( 'Upload Ads image', 'newshit' ),
		'section'     => 'front_video_section',
        'active_callback' => [
			[
				'setting'  => 'video_section_ads_type',
				'operator' => '===',
				'value'    => 'link',
			],
			[
				'setting'  => 'video_ads_enable',
				'operator' => '===',
				'value'    => true,
			]
		],
        'choices'     => [
			'save_as' => 'array',
		],
	]
);

new \Kirki\Field\URL(
	[
		'settings' => 'video_section_ads_url',
		'label'    => esc_html__( 'Ads URL', 'newshit' ),
		'section'  => 'front_video_section',
		'default'  => '#',
        'active_callback' => [
			[
				'setting'  => 'video_section_ads_type',
				'operator' => '===',
				'value'    => 'link',
			],
			[
				'setting'  => 'video_ads_enable',
				'operator' => '===',
				'value'    => true,
			]
		], 
	]
);

new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'video_section_ads_pro',
		'label'       => esc_html__( 'Code Is Pro Featured', 'newshit' ),
		'description' => newshit_purchase_link(),
		'section'     => 'front_video_section',
		'default'     => '',
		'transport'   => 'auto',
		'choices'     => [
			'1'   => get_template_directory_uri() . '/assets/image/pro/ads-code.jpg',
		],
		'active_callback' => [
			[
				'setting'  => 'video_section_ads_type',
				'operator' => '===',
				'value'    => 'code',
			],
			[
				'setting'  => 'video_ads_enable',
				'operator' => '===',
				'value'    => true,
			]
		],
	]
);

