<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

use Carbon_Fields\Field\Field;
use Gigneo\Modules;
use Gigneo\Post_Meta\Serialized;

$gigneo_screening_fields = array();

// Experience Level
$gigneo_screening_fields[] = Field::make( 'select', 'gigneo_pm_experience_level', esc_html__( 'Experience level', 'gigneo' ) )
	->set_options(
		array(
			'entry'        => esc_html__( 'Entry level', 'gigneo' ),
			'intermediate' => esc_html__( 'Intermediate', 'gigneo' ),
			'expert'       => esc_html__( 'expert', 'gigneo' ),
		)
	)
	->set_classes( 'gn-select2' );

// Preferred Location
$gigneo_countries          = gigneo_allowed_countries();
$gigneo_screening_fields[] = Field::make( 'multiselect', 'gigneo_pm_preferred_location', esc_html__( 'Preferred location', 'gigneo' ) )
	->set_options( $gigneo_countries )
	->set_classes( 'gn-select2' );

// Preferred Timezone
$gigneo_timezones            = array();
$gigneo_timezone_identifiers = timezone_identifiers_list();
foreach ( $gigneo_timezone_identifiers as $gigneo_timezone ) {
	$gigneo_timezones[ $gigneo_timezone ] = $gigneo_timezone;
}
$gigneo_screening_fields[] = Field::make( 'select', 'gigneo_pm_preferred_timezone', esc_html__( 'Preferred timezone', 'gigneo' ) )
	->set_options( $gigneo_timezones )
	->set_classes( 'gn-select2' );

// Preferred Language
$gigneo_language_list = array();

$gigneo_languages = new WP_Term_Query(
	array(
		'taxonomy'   => 'gigneo_language',
		'hide_empty' => false,
	)
);

if ( ! is_wp_error( $gigneo_languages ) && ! empty( $gigneo_languages->terms ) ) {
	foreach ( $gigneo_languages->terms as $gigneo_language ) {
		$gigneo_language_list[ $gigneo_language->slug ] = $gigneo_language->name;
	}
}

$gigneo_screening_fields[] = Field::make( 'select', 'gigneo_pm_preferred_language', esc_html__( 'Preferred language', 'gigneo' ) )
	->set_options( $gigneo_language_list )
	->set_classes( 'gn-select2' );

// Language Proficiency
$gigneo_screening_fields[] = Field::make( 'select', 'gigneo_pm_language_proficiency', esc_html__( 'Proficiency', 'gigneo' ) )
	->set_options( gigneo_language_levels( false ) )
	->set_classes( 'gn-select2' );

// Application Deadline
$gigneo_screening_fields[] = Field::make( 'date', 'gigneo_pm_application_deadline', esc_html__( 'Application deadline', 'gigneo' ) )
	->set_storage_format( 'Y-m-d' );



