<?php 

Kirki::add_section( 'header_meddle_section', array(
	'title'    => esc_html__( 'Header Meddle', 'newshit' ),
	'panel'    => 'header_options',
) );

// Header One Version

new \Kirki\Field\Color(
	[
		'settings'    => 'header_meddle_bg',
		'label'       => __( 'Background Color', 'newshit' ),
		'description' => esc_html__( 'Add Header Meddle Background Color', 'newshit' ),
		'section'     => 'header_meddle_section',
        'transport' => 'auto',
        'default'   => '#ffffff',
		'active_callback' => [
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'one',
			]
		],
        'output' => array(
            array(
                'element'  => '.header-one .header-center-wrapper',
                'property' => 'background-color',
            ),
        ),
	]
);

new \Kirki\Field\Checkbox_Switch(
	[
		'settings'    => 'header_ads1_enable',
		'label'       => esc_html__( 'Enable Ads', 'newshit' ),
		'description' => esc_html__( 'Enable your Header Ads If you need', 'newshit' ),
		'section'     => 'header_meddle_section',
		'default'     => 'on',
		'choices'     => [
			'on'  => esc_html__( 'Enable', 'newshit' ),
			'off' => esc_html__( 'Disable', 'newshit' ),
		],
		'active_callback' => [
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'one',
			]
		],
	]
);

new \Kirki\Field\Select(
	[
		'settings'    => 'header_ads_options',
		'label'       => esc_html__( 'Select Ads Type', 'newshit' ),
		'section'     => 'header_meddle_section',
		'default'     => 'link',
		'active_callback' => [
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'one',
			],
			[
				'setting'  => 'header_ads1_enable',
				'operator' => '===',
				'value'    => true,
			]
		],
		'choices'     => [
			'link' => esc_html__( 'Link', 'newshit' ),
			'code' => esc_html__( 'Code', 'newshit' ),
		],
		'partial_refresh'    => [
			'header_ads1_enable_refresh' => [
				'selector'        => '.header-ads-inner',
				'render_callback' => 'newshit_customizer_quickedit',
			],
		],
	]
);

new \Kirki\Field\Image(
	[
		'settings'    => 'header_ads_image',
		'label'       => esc_html__( 'Upload Ads image', 'newshit' ),
		'section'     => 'header_meddle_section',
        'active_callback' => [
			[
				'setting'  => 'header_ads_options',
				'operator' => '===',
				'value'    => 'link',
			],
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'one',
			],
			[
				'setting'  => 'header_ads1_enable',
				'operator' => '===',
				'value'    => true,
			]
		],
        'choices'     => [
			'save_as' => 'array',
		],
	]
);

new \Kirki\Field\URL(
	[
		'settings' => 'header_ads_url',
		'label'    => esc_html__( 'Ads URL', 'newshit' ),
		'section'  => 'header_meddle_section',
		'default'  => '#',
        'active_callback' => [
			[
				'setting'  => 'header_ads_options',
				'operator' => '===',
				'value'    => 'link',
			],
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'one',
			],
			[
				'setting'  => 'header_ads1_enable',
				'operator' => '===',
				'value'    => true,
			]
		], 
	]
);

new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'header_ads_pro',
		'label'       => esc_html__( 'Code Is Pro Featured', 'newshit' ),
		'description' => newshit_purchase_link(),
		'section'     => 'header_meddle_section',
		'default'     => '',
		'transport'   => 'auto',
		'choices'     => [
			'header_ads_code'   => get_template_directory_uri() . '/assets/image/pro/ads-code.jpg',
		],
		'active_callback' => [
			[
				'setting'  => 'header_ads_options',
				'operator' => '===',
				'value'    => 'code',
			],
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'one',
			],
			[
				'setting'  => 'header_ads1_enable',
				'operator' => '===',
				'value'    => true,
			]
		],
	]
);


// Header Tow Version 




new \Kirki\Field\Background(
	[
		'settings'    => 'header2_center_bg',
		'label'       => esc_html__( 'Background', 'newshit' ),
		'description' => esc_html__( 'Add Header Center Background Color or Image', 'newshit' ),
		'section'     => 'header_meddle_section',
		'default'     => [
			'background-image'      => ''. get_template_directory_uri() .'/assets/image/header/header-bg.jpg',
			'background-repeat'     => 'repeat',
			'background-position'   => 'center center',
			'background-size'       => 'cover',
			'background-attachment' => 'scroll',
			'background-color'      => '',
		],
		'transport'   => 'auto',
		'output'      => [
			[
				'element' => '.header-two .header-center-wrapper',
			],
		],
		'active_callback' => [
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'two',
			]
		],
	]
);

new \Kirki\Field\Color(
	[
		'settings'    => 'header2_center_after_bg',
		'label'       => __( 'Image Opacity Color', 'newshit' ),
		'description' => esc_html__( 'Regular color control, no alpha channel.', 'newshit' ),
		'section'     => 'header_meddle_section',
		'default'     => 'rgba(0, 0, 0, 0.76)',
		'choices'     => [
			'alpha' => true,
		],
		'transport'   => 'auto',
		'active_callback' => [
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'two',
			]
		],
		'output'      => [
			[
				'element' => '.header-two .header-center-wrapper:after',
				'property' => 'background-color',
			],
		],
	]
);

// Ads Options 
Kirki::add_field( 'theme_config', [
	'type'        => 'switch',
	'settings'    => 'header_center_ads_enable',
	'label'       => esc_html__( 'Enable Header Ads', 'newshit' ),
	'description' => esc_html__( 'Enable Header Ads Area', 'newshit' ),
	'section'     => 'header_meddle_section',
	'default'     => 'on',
	'choices'     => [
		'on'  => esc_html__( 'Enable', 'newshit' ),
		'off' => esc_html__( 'Disable', 'newshit' ),
	],
	'active_callback' => [
		[
			'setting'  => 'select_header',
			'operator' => '===',
			'value'    => 'two',
		]
	],
	'partial_refresh'    => [
		'header_ads1_enable_refresh' => [
			'selector'        => '.header-ads-inner',
			'render_callback' => 'newshit_customizer_quickedit',
		],
	],
] );



new \Kirki\Field\Select(
	[
		'settings'    => 'header2_ads_options',
		'label'       => esc_html__( 'Select Ads Type', 'newshit' ),
		'section'     => 'header_meddle_section',
		'default'     => 'link',
		'active_callback' => [
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'two',
			],
			[
				'setting'  => 'header_center_ads_enable',
				'operator' => '===',
				'value'    => true,
			]
		],
		'choices'     => [
			'link' => esc_html__( 'Link', 'newshit' ),
			'code' => esc_html__( 'Code', 'newshit' ),
		],
		
	]
);

new \Kirki\Field\Image(
	[
		'settings'    => 'header2_ads_image',
		'label'       => esc_html__( 'Upload Ads image', 'newshit' ),
		'section'     => 'header_meddle_section',
        'active_callback' => [
			[
				'setting'  => 'header2_ads_options',
				'operator' => '===',
				'value'    => 'link',
			],
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'two',
			],
			[
				'setting'  => 'header_center_ads_enable',
				'operator' => '===',
				'value'    => true,
			]
		],
        'choices'     => [
			'save_as' => 'array',
		],
	]
);

new \Kirki\Field\URL(
	[
		'settings' => 'header2_ads_url',
		'label'    => esc_html__( 'Ads URL', 'newshit' ),
		'section'  => 'header_meddle_section',
		'default'  => '#',
        'active_callback' => [
			[
				'setting'  => 'header2_ads_options',
				'operator' => '===',
				'value'    => 'link',
			],
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'two',
			],
			[
				'setting'  => 'header_center_ads_enable',
				'operator' => '===',
				'value'    => true,
			]
		], 
	]
);

new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'header2_ads_pro',
		'label'       => esc_html__( 'Code Is Pro Featured', 'newshit' ),
		'description' => newshit_purchase_link(),
		'section'     => 'header_meddle_section',
		'default'     => '',
		'transport'   => 'auto',
		'choices'     => [
			'header2_ads_code1'   => get_template_directory_uri() . '/assets/image/pro/ads-code.jpg',
		],
		'active_callback' => [
			[
				'setting'  => 'header2_ads_options',
				'operator' => '===',
				'value'    => 'code',
			],
			[
				'setting'  => 'select_header',
				'operator' => '===',
				'value'    => 'two',
			],
			[
				'setting'  => 'header_center_ads_enable',
				'operator' => '===',
				'value'    => true,
			]
		],
	]
);