<?php

if ( ! function_exists( 'calla_elated_footer_options_map' ) ) {
	function calla_elated_footer_options_map() {

		calla_elated_add_admin_page(
			array(
				'slug'  => '_footer_page',
				'title' => esc_html__( 'Footer', 'calla' ),
				'icon'  => 'fa fa-sort-amount-asc'
			)
		);

		$footer_panel = calla_elated_add_admin_panel(
			array(
				'title' => esc_html__( 'Footer', 'calla' ),
				'name'  => 'footer',
				'page'  => '_footer_page'
			)
		);

		calla_elated_add_admin_field(
			array(
				'type'          => 'yesno',
				'name'          => 'footer_in_grid',
				'default_value' => 'yes',
				'label'         => esc_html__( 'Footer in Grid', 'calla' ),
				'description'   => esc_html__( 'Enabling this option will place Footer content in grid', 'calla' ),
				'parent'        => $footer_panel
			)
		);

		calla_elated_add_admin_field(
			array(
				'type'          => 'yesno',
				'name'          => 'show_footer_top',
				'default_value' => 'yes',
				'label'         => esc_html__( 'Show Footer Top', 'calla' ),
				'description'   => esc_html__( 'Enabling this option will show Footer Top area', 'calla' ),
				'parent'        => $footer_panel,
			)
		);
		
		$show_footer_top_container = calla_elated_add_admin_container(
			array(
				'name'       => 'show_footer_top_container',
				'parent'     => $footer_panel,
				'dependency' => array(
					'show' => array(
						'show_footer_top' => 'yes'
					)
				)
			)
		);

		calla_elated_add_admin_field(
			array(
				'type'          => 'select',
				'name'          => 'footer_top_columns',
				'parent'        => $show_footer_top_container,
				'default_value' => '4',
				'label'         => esc_html__( 'Footer Top Columns', 'calla' ),
				'description'   => esc_html__( 'Choose number of columns for Footer Top area', 'calla' ),
				'options'       => array(
					'1' => '1',
					'2' => '2',
					'3' => '3',
					'4' => '4'
				)
			)
		);

		calla_elated_add_admin_field(
			array(
				'type'          => 'select',
				'name'          => 'footer_top_columns_alignment',
				'default_value' => 'left',
				'label'         => esc_html__( 'Footer Top Columns Alignment', 'calla' ),
				'description'   => esc_html__( 'Text Alignment in Footer Columns', 'calla' ),
				'options'       => array(
					''       => esc_html__( 'Default', 'calla' ),
					'left'   => esc_html__( 'Left', 'calla' ),
					'center' => esc_html__( 'Center', 'calla' ),
					'right'  => esc_html__( 'Right', 'calla' )
				),
				'parent'        => $show_footer_top_container,
			)
		);

		calla_elated_add_admin_field(
			array(
				'name'        => 'footer_top_background_color',
				'type'        => 'color',
				'label'       => esc_html__( 'Background Color', 'calla' ),
				'description' => esc_html__( 'Set background color for top footer area', 'calla' ),
				'parent'      => $show_footer_top_container
			)
		);

		calla_elated_add_admin_field(
			array(
				'type'          => 'yesno',
				'name'          => 'show_footer_bottom',
				'default_value' => 'yes',
				'label'         => esc_html__( 'Show Footer Bottom', 'calla' ),
				'description'   => esc_html__( 'Enabling this option will show Footer Bottom area', 'calla' ),
				'parent'        => $footer_panel,
			)
		);

		$show_footer_bottom_container = calla_elated_add_admin_container(
			array(
				'name'            => 'show_footer_bottom_container',
				'parent'          => $footer_panel,
				'dependency' => array(
					'show' => array(
						'show_footer_bottom'  => 'yes'
					)
				)
			)
		);

		calla_elated_add_admin_field(
			array(
				'type'          => 'select',
				'name'          => 'footer_bottom_columns',
				'default_value' => '2',
				'label'         => esc_html__( 'Footer Bottom Columns', 'calla' ),
				'description'   => esc_html__( 'Choose number of columns for Footer Bottom area', 'calla' ),
				'options'       => array(
					'1' => '1',
					'2' => '2',
					'3' => '3'
				),
				'parent'        => $show_footer_bottom_container,
			)
		);

		calla_elated_add_admin_field(
			array(
				'name'        => 'footer_bottom_background_color',
				'type'        => 'color',
				'label'       => esc_html__( 'Background Color', 'calla' ),
				'description' => esc_html__( 'Set background color for bottom footer area', 'calla' ),
				'parent'      => $show_footer_bottom_container
			)
		);
	}

	add_action( 'calla_elated_options_map', 'calla_elated_footer_options_map', 9 );
}