<?php

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

use Carbon_Fields\Field\Field;

$gigneo_service_type = gigneo_option( '_gigneo_ts_service_type', 'both' );

if ( 'both' === $gigneo_service_type ) {
	$gigneo_general_fields[] =
		Field::make( 'select', 'gigneo_pm_type', esc_html__( 'Type', 'gigneo' ) )
			->set_options(
				array(
					''       => esc_html__( 'None', 'gigneo' ),
					'remote' => esc_html__( 'Remote', 'gigneo' ),
					'onsite' => esc_html__( 'On Site', 'gigneo' ),
				)
			)
			->set_classes( 'gn-select2' );
}

$gigneo_general_fields[] =
	Field::make( 'select', 'gigneo_pm_delivery_type', esc_html__( 'Onsite delivery', 'gigneo' ) )
		->set_options(
			array(
				'visit_me'    => esc_html__( 'Visit Me', 'gigneo' ),
				'on_location' => esc_html__( 'On Location', 'gigneo' ),
				'both'        => esc_html__( 'Both', 'gigneo' ),
			)
		)
		->set_classes( 'gn-select2' )
		->set_default_value( 'both' )
		->set_conditional_logic(
			array(
				array(
					'field' => 'gigneo_pm_type',
					'value' => 'onsite',
				),
			)
		);

$gigneo_general_fields[] =
	Field::make( 'select', 'gigneo_pm_price_multi_tier', esc_html__( 'Multi tier', 'gigneo' ) )
		->set_default_value( 'yes' )
		->set_classes( 'gn-select2' )
		->set_options(
			array(
				'yes' => esc_html__( 'Yes', 'gigneo' ),
				'no'  => esc_html__( 'No', 'gigneo' ),
			)
		);

$gigneo_general_fields[] =
	Field::make( 'select', 'gigneo_pm_video_type', __( 'Video type', 'gigneo' ) )
		->set_classes( 'gn-select2' )
		->add_options(
			array(
				'video' => esc_html__( 'Self host', 'gigneo' ),
				'link'  => esc_html__( 'Link', 'gigneo' ),
			)
		)
		->set_default_value( 'video' );

$gigneo_general_fields[] =
	Field::make( 'text', 'gigneo_pm_video_link', esc_html__( 'Video URL', 'gigneo' ) )
		->set_conditional_logic(
			array(
				array(
					'field' => 'gigneo_pm_video_type',
					'value' => 'link',
				),
			)
		);

$gigneo_general_fields[] = Field::make( 'rich_text', 'gigneo_pm_description', esc_html__( 'Description', 'gigneo' ) )
	->set_classes( 'gn-pm-field-full' );
