<?php

add_action( 'pxl_post_metabox_register', 'breeza_page_options_register' );
function breeza_page_options_register( $metabox ) {

	$panels = [
		'post' => [
			'opt_name'            => 'post_option',
			'display_name'        => esc_html__( 'Post Options', 'breeza' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'post_settings' => [
					'title'  => esc_html__( 'Post Options', 'breeza' ),
					'icon'   => 'el el-refresh',
					'fields' => array_merge(
						breeza_sidebar_pos_opts(['prefix' => 'post_', 'default' => true, 'default_value' => '-1']),
						array(
							array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'padding',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Spacing Top/Bottom', 'breeza' ),
								'default'        => array(
									'padding-top'    => '',
									'padding-bottom' => '',
									'units'          => 'px',
								)
							),
						)
					)
				],
				'page_title' => [
					'title'  => esc_html__( 'Page Title', 'breeza' ),
					'icon'   => 'el el-indent-left',
					'fields' => array_merge(
						breeza_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
								'id'       => 'sg_post_title',
								'type'     => 'button_set',
								'title'    => esc_html__('Page Title Type', 'breeza'),
								'options'  => array(
									'default' => esc_html__('Default', 'breeza'),
									'custom_text' => esc_html__('Custom Text', 'breeza'),
								),
								'default'  => 'default',
							),
							array(
								'id'      => 'sg_post_title_text',
								'type'    => 'text',
								'title'   => esc_html__('Page Title Text', 'breeza'),								
								'required' => array( 0 => 'sg_post_title', 1 => 'equals', 2 => 'custom_text' ),
							),
							array(
								'id'      => 'sg_post_sub_title_text',
								'type'    => 'text',
								'title'   => esc_html__('Page Sub Title Text', 'breeza'),								
								'required' => array( 0 => 'sg_post_title', 1 => 'equals', 2 => 'custom_text' ),
							),
						),
						array(
							array(
								'id'       => 'post_title_bg',
								'type'     => 'background',
								'title'    => esc_html__('Select Page Title Background', 'breeza'),                
								'output' => [
									'#pxl-page-title-default',
								],
								'url'      => false
							), 
						)
					)
				],
			]
		],
		'page' => [
			'opt_name'            => 'pxl_page_options',
			'display_name'        => esc_html__( 'Page Options', 'breeza' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'Header', 'breeza' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
						breeza_header_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
								'id'       => 'logo_dark',
								'type'     => 'media',
								'title'    => esc_html__('Select Logo', 'breeza'),
								'default' => '',
								'url'      => false,								
							),
						),
						array(
							array(
								'id'       => 'p_menu',
								'type'     => 'select',
								'title'    => esc_html__( 'Menu', 'breeza' ),
								'options'  => breeza_get_nav_menu_slug(),
								'default' => '',
							),
						),
						array(
							array(
								'id'       => 'sticky_scroll',
								'type'     => 'button_set',
								'title'    => esc_html__('Sticky Scroll', 'breeza'),
								'options'  => array(
									'-1' => esc_html__('Inherit', 'breeza'),
									'pxl-sticky-stt' => esc_html__('Scroll To Top', 'breeza'),
									'pxl-sticky-stb'  => esc_html__('Scroll To Bottom', 'breeza'),
								),
								'default'  => '-1',
							),
						)
					)

				],
				'page_title' => [
					'title'  => esc_html__( 'Page Title', 'breeza' ),
					'icon'   => 'el el-indent-left',
					'fields' => array_merge(
						breeza_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
								'id'       => 'sg_post_title',
								'type'     => 'button_set',
								'title'    => esc_html__('Page Title Type', 'breeza'),
								'options'  => array(
									'default' => esc_html__('Default', 'breeza'),
									'custom_text' => esc_html__('Custom Text', 'breeza'),
								),
								'default'  => 'default',
							),
							array(
								'id'      => 'sg_post_title_text',
								'type'    => 'text',
								'title'   => esc_html__('Page Title Text', 'breeza'),								
								'required' => array( 0 => 'sg_post_title', 1 => 'equals', 2 => 'custom_text' ),
							),
							array(
								'id'      => 'sg_post_sub_title_text',
								'type'    => 'text',
								'title'   => esc_html__('Page Sub Title Text', 'breeza'),								
								'required' => array( 0 => 'sg_post_title', 1 => 'equals', 2 => 'custom_text' ),
							),
						),
						array(
							array(
								'id'       => 'page_title_bg',
								'type'     => 'background',
								'title'    => esc_html__('Select Page Title Background', 'breeza'),                
								'output' => [
									'#pxl-page-title-default',
								],
								'url'      => false
							), 
						)
					)
				],
				'content' => [
					'title'  => esc_html__( 'Content', 'breeza' ),
					'icon'   => 'el-icon-pencil',
					'fields' => array_merge(
						breeza_sidebar_pos_opts(['prefix' => 'page_', 'default' => false, 'default_value' => '0']),
						array(
							array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'padding',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Spacing Top/Bottom', 'breeza' ),
								'default'        => array(
									'padding-top'    => '',
									'padding-bottom' => '',
									'units'          => 'px',
								)
							), 
						)
					)
				],
				'footer' => [
					'title'  => esc_html__( 'Footer', 'breeza' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
						breeza_footer_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
								'id'       => 'footer_display',
								'type'     => 'button_set',
								'title'    => esc_html__('Footer Display', 'breeza'),
								'options'  => array(
									'show' => esc_html__('Show', 'breeza'),
									'hide'  => esc_html__('Hide', 'breeza'),
								),
								'default'  => 'show',
							)
						),
						array(
							array(
								'id'       => 'p_footer_fixed',
								'type'     => 'button_set',
								'title'    => esc_html__('Footer Fixed', 'breeza'),
								'options'  => array(
									'inherit' => esc_html__('Inherit', 'breeza'),
									'on' => esc_html__('On', 'breeza'),
									'off' => esc_html__('Off', 'breeza'),
								),
								'default'  => 'inherit',
							),
						)
					)
				],
				'colors' => [
					'title'  => esc_html__( 'Colors', 'breeza' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
						array(
							array(
								'id'          => 'body_bg_color',
								'type'        => 'color',
								'title'       => esc_html__('Body Background Color', 'breeza'),
								'transparent' => false,
								'default'     => ''
							),
							array(
								'id'          => 'primary_color',
								'type'        => 'color',
								'title'       => esc_html__('Primary Color', 'breeza'),
								'transparent' => false,
								'default'     => ''
							),
							array(
								'id'          => 'secondary_color',
								'type'        => 'color',
								'title'       => esc_html__('Scondary Color', 'breeza'),
								'transparent' => false,
								'default'     => ''
							),
							array(
								'id'          => 'third_color',
								'type'        => 'color',
								'title'       => esc_html__('Third Color', 'breeza'),
								'transparent' => false,
								'default'     => ''
							),
							array(
								'id'          => 'four_color',
								'type'        => 'color',
								'title'       => esc_html__('Four Color', 'breeza'),
								'transparent' => false,
								'default'     => ''
							),
							array(
								'id'          => 'gradient_color',
								'type'        => 'color_gradient',
								'title'       => esc_html__('Gradient Color', 'breeza'),
								'transparent' => false,
								'default'  => array(
									'from' => '',
									'to'   => '', 
								),
							),
						)
					)
				],
				'extra' => [
					'title'  => esc_html__( 'Extra', 'breeza' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
						array(
							array(
								'id' => 'body_custom_class',
								'type' => 'text',
								'title' => esc_html__('Body Custom Class', 'breeza'),
							),
						)
					)
				]
			]
		],
		'service' => [
			'opt_name'            => 'pxl_service_options',
			'display_name'        => esc_html__( 'Service Options', 'breeza' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'General', 'breeza' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
						breeza_sidebar_pos_opts(['prefix' => 'service_', 'default' => true, 'default_value' => '-1']),
						breeza_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
								'id'       => 'service_icon_type',
								'type'     => 'button_set',
								'title'    => esc_html__('Icon Type', 'breeza'),
								'options'  => array(
									'icon'  => esc_html__('Icon', 'breeza'),
									'image'  => esc_html__('Image', 'breeza'),
								),
								'default'  => 'icon'
							),
							array(
								'id'       => 'service_icon_font',
								'type'     => 'pxl_iconpicker',
								'title'    => esc_html__('Icon', 'breeza'),
								'required' => array( 0 => 'service_icon_type', 1 => 'equals', 2 => 'icon' ),
								'force_output' => true
							),
							array(
								'id'       => 'service_icon_img',
								'type'     => 'media',
								'title'    => esc_html__('Icon Image', 'breeza'),
								'default' => '',
								'required' => array( 0 => 'service_icon_type', 1 => 'equals', 2 => 'image' ),
								'force_output' => true
							),
							array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'padding',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Content Spacing Top/Bottom', 'breeza' ),
								'default'        => array(
									'padding-top'    => '',
									'padding-bottom' => '',
									'units'          => 'px',
								)
							),
						)
					)
				],
			]
		],
		'case' => [
			'opt_name'            => 'pxl_case_options',
			'display_name'        => esc_html__( 'Case Options', 'breeza' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'General', 'breeza' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
						breeza_sidebar_pos_opts(['prefix' => 'case_', 'default' => true, 'default_value' => '-1']),
						breeza_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'padding',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Content Spacing Top/Bottom', 'breeza' ),
								'default'        => array(
									'padding-top'    => '',
									'padding-bottom' => '',
									'units'          => 'px',
								)
							),
						)
					)
				],
				'footer' => [
					'title'  => esc_html__( 'Footer', 'breeza' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
						breeza_footer_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
								'id'       => 'p_footer_fixed',
								'type'     => 'button_set',
								'title'    => esc_html__('Footer Fixed', 'breeza'),
								'options'  => array(
									'inherit' => esc_html__('Inherit', 'breeza'),
									'on' => esc_html__('On', 'breeza'),
									'off' => esc_html__('Off', 'breeza'),
								),
								'default'  => 'inherit',
							),
						)
					)
				],
			]
		],
		'pxl-template' => [ //post_type
		'opt_name'            => 'pxl_hidden_template_options',
		'display_name'        => esc_html__( 'Template Options', 'breeza' ),
		'show_options_object' => false,
		'context'  => 'advanced',
		'priority' => 'default',
		'sections'  => [
			'header' => [
				'title'  => esc_html__( 'General', 'breeza' ),
				'icon'   => 'el-icon-website',
				'fields' => array(
					array(
						'id'    => 'template_type',
						'type'  => 'select',
						'title' => esc_html__('Type', 'breeza'),
						'options' => [
							'df'       	   => esc_html__('Select Type', 'breeza'), 
							'header'       => esc_html__('Header', 'breeza'), 
							'footer'       => esc_html__('Footer', 'breeza'), 
							'mega-menu'    => esc_html__('Mega Menu', 'breeza'), 
							'page-title'   => esc_html__('Page Title', 'breeza'), 
							'tab' => esc_html__('Tab', 'breeza'),
							'hidden-panel' => esc_html__('Hidden Panel', 'breeza'),
							'popup' => esc_html__('Popup', 'breeza'),
							'widget' => esc_html__('Widget Sidebar', 'breeza'),								
							'slider' => esc_html__('Slider', 'breeza'),
						],
						'default' => 'df',
					),
					array(
						'id'    => 'header_type',
						'type'  => 'select',
						'title' => esc_html__('Header Type', 'breeza'),
						'options' => [
							'px-header--default'       	   => esc_html__('Default', 'breeza'), 
							'px-header--transparent'       => esc_html__('Transparent', 'breeza'),
						],
						'default' => 'px-header--default',
						'indent' => true,
						'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'header' ),
					),
					array(
						'id'    => 'header_fixed',
						'type'  => 'select',
						'title' => esc_html__('Header Fixed', 'breeza'),
						'options' => [
							'df'       	   => esc_html__('Default', 'breeza'), 
							'pxl-header--fix'       => esc_html__('Fixed', 'breeza'),
						],
						'desc'     => 'If you enable this mode, do not use sticky header.',
						'default' => 'df',
						'indent' => true,
						'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'header' ),
					),
					array(
						'id'          => 'hidden_panel_bg',
						'type'        => 'color',
						'title'       => esc_html__('Hidden Panel Box Color', 'breeza'),
						'transparent' => false,
						'default'     => '',
						'force_output' => true,
						'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'hidden-panel' ),
					),
					array(
						'id'          => 'hidden_panel_width',
						'type'        => 'text',
						'title'       => esc_html__('Hidden Panel Width', 'breeza'),
						'subtitle'       => esc_html__('Enter number.', 'breeza'),
						'transparent' => false,
						'default'     => '',
						'force_output' => true,
						'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'hidden-panel' ),
					),
					array(
						'id'          => 'header_sidebar_width',
						'type'        => 'slider',
						'title'       => esc_html__('Header Sidebar Width', 'breeza'),
						"default"   => 300,
						"min"       => 50,
						"step"      => 1,
						"max"       => 900,
						'force_output' => true,
						'required' => array( 0 => 'header_type', 1 => 'equals', 2 => 'px-header--left_sidebar' ),
					),
				),

			],
		]
	],
			'pxl-slider' => [ //post_type
			'opt_name'            => 'slide_option',
			'display_name'        => esc_html__( 'Slide Settings', 'breeza' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'post_settings' => [
					'title'  => esc_html__( 'Slide Settings', 'breeza' ),
					'icon'   => 'el-icon-website',
					'fields' => array(
						array(
							'id'          => 'sub_title',
							'type'        => 'text',
							'title'       => esc_html__('Sub Title', 'breeza'),
							'default'     => ''
						),
						array(
							'id'          => 'custom_title',
							'type'        => 'text',
							'title'       => esc_html__('Custom Title', 'breeza'),
							'default'     => ''
						),
					)
				]
			]
		], 
	];

	$metabox->add_meta_data( $panels );
}
