<?php

Kirki::add_section('header_top_section', array(
	'title'    => esc_html__('Header Top', 'newscope'),
	'panel'    => 'header_options',
));

Kirki::add_field('theme_config', [
	'type'        => 'switch',
	'settings'    => 'enable_top_header',
	'label'       => esc_html__('Enable Top Header', 'newscope'),
	'description' => esc_html__('Enable hide or show Top Header', 'newscope'),
	'section'     => 'header_top_section',
	'default'     => 'on',
	'priority'        => 1,
	'choices'     => [
		'on'  => esc_html__('Enable', 'newscope'),
		'off' => esc_html__('Disable', 'newscope'),
	],
]);


new \Kirki\Field\Background(
	[
		'settings'    => 'header_top_bg',
		'label'       => esc_html__('Header Top Background', 'newscope'),
		'description' => esc_html__('Add header Top section background color or image', 'newscope'),
		'section'     => 'header_top_section',
		'default'     => [
			'background-color'      => 'rgba(20,20,20,.8)',
			'background-image'      => get_template_directory_uri() . '/assets/image/header-top/hader-bg-img.jpg',
			'background-repeat'     => 'repeat',
			'background-position'   => 'center center',
			'background-size'       => 'cover',
			'background-attachment' => 'scroll',
		],
		'transport'   => 'auto',
		'priority'        => 1,
		'output'      => [
			[
				'element' => '.top-header',
			],
		],
		'active_callback' => [
			[
				'setting'  => 'enable_top_header',
				'operator' => '===',
				'value'    => true,
			],
		], 
	]
);

// News Sticker 
new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'enable_newssticker_pro',
		'label'       => esc_html__( 'Purchase Pro', 'newscope' ),
		'description' => newscope_purchase_link(),
		'section'     => 'header_top_section',
		'default'     => '',
		'transport'   => 'auto',
		'priority'        => 1,
		'choices'     => [
			'1'   => get_template_directory_uri() . '/assets/image/pro/news-sticker.jpg',
		],
	]
);


// Post Filter Options 

Kirki::add_field( 'theme_config', [
	'type'        => 'switch',
	'settings'    => 'enable_sticker_filter',
	'label'       => esc_html__( 'Enable Post Filter', 'newscope' ),
	'section'     => 'header_top_section',
	'default'     => 'off',
	'priority'        => 1,
	'choices'     => [
		'on'  => esc_html__( 'Enable', 'newscope' ),
		'off' => esc_html__( 'Disable', 'newscope' ),
	],
	'active_callback' => [
		[
			'setting'  => 'enable_news_sticker',
			'operator' => '===',
			'value'    => true,
		],
		[
			'setting'  => 'enable_top_header',
			'operator' => '===',
			'value'    => true,
		]
	],
] );

new \Kirki\Field\Select(
	[
		'settings'    => 'sticker_filter_select',
		'label'       => esc_html__( 'Select Category Or Tags', 'newscope' ),
		'section'     => 'header_top_section',
		'default'     => 'one',
		'priority'        => 1,
		'choices'     => [
			'one' => esc_html__( 'Category', 'newscope' ),
			'two' => esc_html__( 'Tags', 'newscope' ),
		],
		'active_callback' => [
			[
				'setting'  => 'enable_sticker_filter',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_news_sticker',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_top_header',
				'operator' => '===',
				'value'    => true,
			]
		], 
	]
);

new Kirki\Field\Select(
	[
		'settings'    => 'sticker_filter_cat',
		'label'       => __( 'Select Categroy', 'newscope' ),
		'section'     => 'header_top_section',
		'default'     => '',
		'multiple'    => -1,
		'priority'        => 1,
		'placeholder' => __( 'Select an Categorys', 'newscope' ),
		'choices'     => Kirki\Util\Helper::get_terms(array('taxonomy' => 'category')),
		'active_callback' => [
			[
				'setting'  => 'sticker_filter_select',
				'operator' => '===',
				'value'    => 'one',
			],
			[
				'setting'  => 'enable_sticker_filter',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_news_sticker',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_top_header',
				'operator' => '===',
				'value'    => true,
			],
		], 
	]
);

	// pro
	new \Kirki\Field\Radio_Image(
		[
			'settings'    => 'enable_sticker_tag_pro',
			'label'       => esc_html__( 'Purchase Pro', 'newscope' ),
			'description' => newscope_purchase_link(),
			'section'     => 'header_top_section',
			'default'     => '',
			'transport'   => 'auto',
			'priority'        => 1,
			'choices'     => [
				'1'   => get_template_directory_uri() . '/assets/image/pro/tags-pro.jpg',
			],
			'active_callback' => [
				[
					'setting'  => 'sticker_filter_select',
					'operator' => '===',
					'value'    => 'two',
				],
				[
					'setting'  => 'enable_sticker_filter',
					'operator' => '===',
					'value'    => true,
				],
				[
					'setting'  => 'enable_news_sticker',
					'operator' => '===',
					'value'    => true,
				],
				[
					'setting'  => 'enable_top_header',
					'operator' => '===',
					'value'    => true,
				],
			], 
		]
	);
		
new \Kirki\Field\Select(
	[
		'settings'        => 'news_sticker_order',
		'label'           => esc_html__( 'Post Order', 'newscope' ),
		'section'         => 'header_top_section',
		'default'         => 'ASC',
		'priority'        => 1,
		'placeholder'     => esc_html__( 'Choose an option', 'newscope' ),
		'choices'         => [
			'ASC'  => esc_html__( 'ASC', 'newscope' ),
			'DESE' => esc_html__( 'DESE', 'newscope' ),
		],
		'active_callback' => [
			[
				'setting'  => 'enable_news_sticker',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_top_header',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);

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

new \Kirki\Field\Number(
	[
		'settings' => 'news_sticker_title_lanth',
		'label'    => esc_html__( 'Title Length', 'newscope' ),
		'section'  => 'header_top_section',
		'default'  => 20,
		'priority'        => 1,
		'choices'  => [
			'min'  => 1,
			'max'  => 50,
			'step' => 1,
		],
		'active_callback' => [
			[
				'setting'  => 'enable_news_sticker',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_top_header',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);

new \Kirki\Field\Number(
	[
		'settings' => 'news_sticker_dispaly',
		'label'    => esc_html__( 'Post Number', 'newscope' ),
		'section'  => 'header_top_section',
		'default'  => 42,
		'priority'        => 1,
		'choices'  => [
			'min'  => 1,
			'max'  => 80,
			'step' => 1,
		],
		'active_callback' => [
			[
				'setting'  => 'enable_news_sticker',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_top_header',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);





//----------------------------------//
//------ START SOCIAL OPTIONS -----//
//--------------------------------//

Kirki::add_field('theme_config', [
	'type'        => 'switch',
	'settings'    => 'header_top_social',
	'label'       => esc_html__('Enable Social Icon', 'newscope'),
	'description' => esc_html__('Enable Header Top Social Icons', 'newscope'),
	'section'     => 'header_top_section',
	'default'     => 'on',
	'priority'        => 1,
	'choices'     => [
		'on'  => esc_html__('Enable', 'newscope'),
		'off' => esc_html__('Disable', 'newscope'),
	],
	'partial_refresh'    => [
		'header_top_social_refresh' => [
			'selector'        => '.news-social-links',
			'render_callback' => 'newscope_customizer_quickedit',
		],
	],
	'active_callback' => [
		[
			'setting'  => 'enable_top_header',
			'operator' => '===',
			'value'    => true,
		],
	],
]);

Kirki::add_field('theme_config', [
	'type'            => 'Repeater',
	'settings'        => 'header_social_icons',
	'label'           => esc_html__('Socials Icon', 'newscope'),
	'section'         => 'header_top_section',
	'row_label'       => [
		'type'  => 'field',
		'field' => 'name',
	],
	'choices' => [
		'limit' => 4
	],
	'priority'        => 1,
	'button_label'    => esc_html__('"Add Social Icon', 'newscope'),
	'default'         => [
		[
			'name'     => esc_html__('Facebook', 'newscope'),
			'icon'     => 'fab fa-facebook-f',
			'link'     => '#',
			'target'   => '_self',
			'color'    => '#175BEB',
		],
		[
			'name'     => esc_html__('Twitter', 'newscope'),
			'icon'     => 'fab fa-twitter',
			'link'     => '#',
			'target'   => '_self',
			'color'    => '#1DA1F2',
		],
		[
			'name'     => esc_html__('Linkedin', 'newscope'),
			'icon'     => 'fab fa-linkedin-in',
			'link'     => '#',
			'target'   => '_self',
			'color'    => '#0072B1',
		],
		[
			'name'     => esc_html__('Instagram', 'newscope'),
			'icon'     => 'fab fa-instagram',
			'link'     => '#',
			'target'   => '_self',
			'color'    => '#d62976',
		]
	],
	'fields'          => [
		'name'     => [
			'type'        => 'text',
			'label'       => esc_html__('Social Name', 'newscope'),
			'description' => esc_html__('Add Social Media Name', 'newscope'),
			'default'     => esc_html__('Facebook', 'newscope'),
		],

		'icon'     => [
			'type'        => 'select',
			'label'       => esc_html__('Social Icon', 'newscope'),
			'description' => esc_html__('Add Social Icon Here', 'newscope'),
			'default'     => 'fab fa-facebook-f',
			'choices'     => [
				'fab fa-facebook-f'     => esc_attr__('Facebook', 'newscope'),
				'fab fa-twitter'        => esc_attr__('Twitter', 'newscope'),
				'fab fa-linkedin-in'    => esc_attr__('Linkedin', 'newscope'),
				'fab fa-instagram'      => esc_attr__('Instagram', 'newscope'),
				'fab fa-pinterest'      => esc_attr__('Pinterest', 'newscope'),
				'fab fa-dribbble'       => esc_attr__('Dribbble', 'newscope'),
				'fab fa-behance'        => esc_attr__('Behance', 'newscope'),
				'fab fa-tiktok'         => esc_attr__('Tiktok', 'newscope'),
				'fab fa-snapchat-ghost' => esc_attr__('Snapchat', 'newscope'),
				'fab fa-youtube'        => esc_attr__('Youtube', 'newscope'),
				'fab fa-weixin'         => esc_attr__('Weixin', 'newscope'),
				'fab fa-telegram'       => esc_attr__('Telegram', 'newscope'),
				'fab fa-reddit'         => esc_attr__('Reddit', 'newscope'),
				'fab fa-quora'          => esc_attr__('Quora', 'newscope'),
				'fab fa-discord'        => esc_attr__('Discord', 'newscope'),
				'fab fa-whatsapp'       => esc_attr__('Whatsapp', 'newscope'),
			],
		],
		'link'     => [
			'type'        => 'text',
			'label'       => esc_html__('Link URL', 'newscope'),
			'description' => esc_html__('Add Social Link Here', 'newscope'),
			'default'     => '#',
		],
		'target'   => [
			'type'        => 'select',
			'label'       => esc_html__('Link Target', 'newscope'),
			'description' => esc_html__('Select Target Option', 'newscope'),
			'default'     => '_self',
			'choices'     => [
				'_blank' => esc_html__('New Window', 'newscope'),
				'_self'  => esc_html__('Same Frame', 'newscope'),
			],
		],
		'color'    => [
			'type'        => 'color',
			'label'       => esc_html__('Icon Color', 'newscope'),
			'description' => esc_html__('Add Social Icon Color', 'newscope'),
			'alpha'       => true,
			'transport'   => 'auto',
		]
	],
	'active_callback' => [
		[
			'setting'  => 'header_top_social',
			'operator' => '===',
			'value'    => true,
		],
		[
			'setting'  => 'enable_top_header',
			'operator' => '===',
			'value'    => true,
		],
	],
]);
new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'header_top_social_pro',
		'label'       => esc_html__( 'Purchase Pro For Add Unlimited Social Links', 'newscope' ),
		'description' => newscope_purchase_link(),
		'section'     => 'header_top_section',
		'default'     => '',
		'transport'   => 'auto',
		'priority'        => 1,
		'active_callback' => [
			[
				'setting'  => 'header_top_social',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_top_header',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);

// Notification Options

// pro
new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'header_notifications_pro',
		'label'       => esc_html__( 'Purchase Pro', 'newscope' ),
		'description' => newscope_purchase_link(),
		'section'     => 'header_top_section',
		'default'     => '',
		'transport'   => 'auto',
		'priority'        => 2,
		'choices'     => [
			'1'   => get_template_directory_uri() . '/assets/image/pro/subscribe.jpg',
		],
	]
);

new \Kirki\Field\URL(
	[
		'settings' => 'header_notification_url',
		'label'    => esc_html__('Subscribe URL', 'newscope'),
		'section'  => 'header_top_section',
		'priority'        => 2,
		'default'  => '#',
		'active_callback' => [
			[
				'setting'  => 'header_notification',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_top_header',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);

new \Kirki\Field\Checkbox(
	[
		'settings'    => 'notification_new_tab',
		'label'       => esc_html__('Open New Tab?', 'newscope'),
		'section'     => 'header_top_section',
		'priority'        => 2,
		'active_callback' => [
			[
				'setting'  => 'header_notification',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_top_header',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);


