<?php

namespace Tech360;

defined( 'ABSPATH' ) or die;

$t360_customizer = new Customizer( 'tech360', true );

/**
 * Contact settings
 * Contact mods array is defined in /theme-code/constants.php
 */
$t360_customizer->add_section( [
	'id' => 'contact_settings',
	'title' => __( 'Contact Info', 'tech360' ),
	'priority' => 32,
	'description' => __( 'Fill in your contact information that will be displayed throughout the site.', 'tech360' )
] );
foreach( CONTACT_INFO as $id => $data ) {
	$args = [
		'section' => 'contact_settings',
		'id' => $id,
		'title' => $data[ 'title' ]
	];
	if( $data[ 'type' ] ) {
		$args[ 'type' ] = $data[ 'type' ];
	}
	if( $data[ 'description' ] ) {
		$args[ 'description' ] = $data[ 'description' ];
	}
	$t360_customizer->add_control( $args );
}

/**
 * Social networks
 * Social links array is defined in /theme-code/constants.php
 */
$t360_customizer->add_section( [
	'id' => 'social_networks',
	'title' => __( 'Social Networks', 'tech360' ),
	'priority' => 33,
	'description' => __( 'Add your social network profiles. Leave the fields blank if you don\'t want the social networks to be displayed on the site.', 'tech360' )
] );
foreach( SOCIAL_LINKS as $id => $data ) {
	$t360_customizer->add_control( [
		'section' => 'social_networks',
		'id' => $id,
		'title' => $data[ 'title' ]
	] );
}

/**
 * Header top bar
 * Top bar settings array is defined in /theme-code/constants.php
 */
$t360_customizer->add_section( [
	'id' => 'top_bar_settings',
	'title' => __( 'Top bar', 'tech360' ),
	'priority' => 34,
	'description' => __( 'Choose what information should be displayed in the site header, above the main menu.', 'tech360' )
] );
foreach( TOP_BAR_OPTIONS as $id => $data ) {
	$args = [
		'section' => 'top_bar_settings',
		'id' => $id,
		'title' => $data[ 'title' ]
	];
	if( array_key_exists( 'type', $data ) ) {
		$args[ 'type' ] = $data[ 'type' ];
	}
	if( array_key_exists( 'description', $data ) ) {
		$args[ 'description' ] = $data[ 'description' ];
	}
	if( array_key_exists( 'default', $data ) ) {
		$args[ 'default' ] = $data[ 'default' ];
	}
	$t360_customizer->add_control( $args );
}

// Footer
$t360_customizer->add_section( [
	'id' => 'footer_settings',
	'title' => __( 'Footer', 'tech360' ),
	'priority' => 35,
	'description' => __( 'These settings affect how the site footer is displayed and what it contains.', 'tech360' )
] );
$t360_customizer->add_control( [
	'section' => 'footer_settings',
	'id' => 'copyright_location',
	'title' => __( 'Copyright info location', 'tech360' ),
	'type' => 'select',
	'choices' => [
		'footer_col_1' => __( 'Footer column 1', 'tech360' ),
		'across_footer' => __( 'Across footer bottom', 'tech360' )
	],
	'description' => __( 'Choose the location of the copyright info from the dropdown.', 'tech360' )
] );
$t360_customizer->add_control( [
	'section' => 'footer_settings',
	'id' => 'copyright_info',
	'title' => __( 'Copyright information', 'tech360' ),
	'type' => 'textarea',
	'description' => __( 'This text will be displayed in the bottom bar on the footer. Available variables: {{year}}, {{site}}.', 'tech360' ),
	'default' => __( 'Copyright &copy; {{year}} {{site}}. All rights reserved.', 'tech360' )
] );
$t360_customizer->add_control( [
	'section' => 'footer_settings',
	'id' => 'credits',
	'title' => __( 'Display website credits', 'tech360' ),
	'type' => 'checkbox',
	'description' => __( 'Check this to display developer credits next to the copyright text.', 'tech360' )
] );
$t360_customizer->add_control( [
	'section' => 'footer_settings',
	'id' => 'footer_layout',
	'title' => __( 'Footer layout', 'tech360' ),
	'type' => 'select',
	'choices' => [
		'four_col' => __( 'Four columns', 'tech360' ),
		'three_col' => __( 'Three columns', 'tech360' ),
		'two_col' => __( 'Two columns', 'tech360' )
	],
	'default' => 'four_col'
] );

// Theme customizations
// $t360_customizer->add_section( [
// 	'id' => 'theme_settings',
// 	'title' => 'Theme Customizations',
// 	'priority' => 35,
// 	'description' => '<p>This section allows you to change some of the theme variables.</p><p>We suggest you leave these fields blank and use the default theme settings.</p>'
// ] );
// $t360_customizer->add_control( [ 'section' => 'theme_settings', 'id' => 'primary_color', 'title' => 'Primary color', 'type' => 'color', 'description' => 'The primary color is used mainly on buttons and some accents throughout the site.' ] );
// $t360_customizer->add_control( [ 'section' => 'theme_settings', 'id' => 'secondary_color', 'title' => 'Secondary color', 'type' => 'color', 'description' => 'The secondary color is usually complementary to the primary color and is not used as much throughout the site.' ] );
// $t360_customizer->add_control( [ 'section' => 'theme_settings', 'id' => 'headings_color', 'title' => 'Headings color', 'type' => 'color', 'description' => 'Color used for headings.' ] );
// $t360_customizer->add_control( [ 'section' => 'theme_settings', 'id' => 'text_color', 'title' => 'Text color', 'type' => 'color', 'description' => 'Color used for body text.' ] );

// Render the customizer
$t360_customizer->render();
