<?php

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

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

//Main Heading
$gigneo_other_main_heading = Theme_Option::render_heading_markup(
	esc_html__( 'Other', 'gigneo' ),
	esc_html__( 'Manage and configure platform other options.', 'gigneo' )
);

$gigneo_other_fields[] =
	Field::make( 'html', 'gigneo_other_main_heading' )
		->set_html( $gigneo_other_main_heading )
		->set_classes( 'gn-ts-main-heading' );

//General - Sections
$gigneo_other_general_heading = Theme_Option::render_heading_markup(
	esc_html__( 'General', 'gigneo' ),
	esc_html__( 'Customize and manage the general core features.', 'gigneo' )
);

$gigneo_other_general_fields[] =
	Field::make( 'html', 'gigneo_ts_heading_other_general' )
		->set_html( $gigneo_other_general_heading )
		->set_classes( 'gn-ts-field-heading' );

$gigneo_other_general_fields[] =
	Field::make( 'multiselect', 'gigneo_ts_image_extensions', esc_html__( 'Image extensions', 'gigneo' ) )
		->set_datastore( new Serialized() )
		->set_options( gigneo_file_extensions( array( 'image' ) ) )
		->set_default_value( array( 'png', 'jpg', 'jpeg' ) );

$gigneo_other_general_fields[] =
	Field::make( 'text', 'gigneo_ts_image_max_size', esc_html__( 'Image size limit', 'gigneo' ) )
		->set_attribute( 'data-regex', '^[0-9]+$' )
		->set_default_value( 1 )
		->set_help_text( esc_html__( 'Set the maximum file size for image that user can upload in MB.', 'gigneo' ) );

$gigneo_other_general_fields[] =
	Field::make( 'multiselect', 'gigneo_ts_video_extensions', esc_html__( 'Video extensions', 'gigneo' ) )
		->set_datastore( new Serialized() )
		->set_options( gigneo_file_extensions( array( 'video' ) ) )
		->set_default_value( array( 'mp4', 'avi', 'mov' ) );

$gigneo_other_general_fields[] =
	Field::make( 'text', 'gigneo_ts_video_max_size', esc_html__( 'Video Size limit', 'gigneo' ) )
		->set_attribute( 'data-regex', '^[0-9]+$' )
		->set_default_value( 10 )
		->set_help_text( esc_html__( 'Set the maximum file size for video that user can upload in MB.', 'gigneo' ) );
$gigneo_other_general_fields[] =
	Field::make( 'multiselect', 'gigneo_ts_audio_extensions', esc_html__( 'Audio extensions', 'gigneo' ) )
		->set_datastore( new Serialized() )
		->set_options(
			array(
				'mp3'  => 'MP3',
				'wav'  => 'WAV',
				'ogg'  => 'OGG',
				'aac'  => 'AAC',
				'webm' => 'webm',
			)
		)
		->set_default_value( array( 'mp3', 'wav', 'webm' ) );

$gigneo_other_general_fields[] =
	Field::make( 'text', 'gigneo_ts_video_audio_size', esc_html__( 'Audio size limit', 'gigneo' ) )
		->set_attribute( 'data-regex', '^[0-9]+$' )
		->set_default_value( 10 )
		->set_help_text( esc_html__( 'Set the maximum file size for audio that user can upload in MB.', 'gigneo' ) );

$gigneo_other_general_fields[] =
	Field::make( 'multiselect', 'gigneo_ts_document_extensions', esc_html__( 'Document extensions', 'gigneo' ) )
		->set_datastore( new Serialized() )
		->set_options( gigneo_file_extensions( array( 'document' ) ) )
		->set_default_value( array( 'pdf', 'doc', 'ppt' ) );

$gigneo_other_general_fields[] =
	Field::make( 'text', 'gigneo_ts_document_max_size', esc_html__( 'Document size limit', 'gigneo' ) )
		->set_attribute( 'data-regex', '^[0-9]+$' )
		->set_default_value( 5 )
		->set_help_text( esc_html__( 'Set the maximum file size for document that user can upload in MB.', 'gigneo' ) );

$gigneo_other_general_fields = apply_filters( 'gigneo_ts_tab_other_section_general_fields', $gigneo_other_general_fields );
$gigneo_other_fields         = array_merge( $gigneo_other_fields, $gigneo_other_general_fields );

//Moderator Fields
$gigneo_moderator_fields[] = Field::make( 'html', 'gigneo_ts_separator_moderator' )
							->set_html( '<hr>' )
							->set_classes( 'gn-separator' );

$gigneo_moderator_heading  = Theme_Option::render_heading_markup(
	esc_html__( 'Moderator', 'gigneo' ),
	esc_html__( 'Configure the moderator settings for your platform.', 'gigneo' )
);
$gigneo_moderator_fields[] = Field::make( 'html', 'gigneo_ts_heading_moderator' )
							->set_html( $gigneo_moderator_heading )
							->set_classes( 'gn-ts-field-heading' );
$gigneo_moderator_fields[] =
	Field::make( 'image', 'gigneo_ts_moderator_avatar', esc_html__( 'Moderator avatar', 'gigneo' ) );

$gigneo_moderator_fields[] = Field::make( 'text', 'gigneo_ts_moderator_name', __( 'Moderator name', 'gigneo' ) )
							->set_default_value( sprintf( '%s moderator', get_bloginfo( 'name' ) ) );

$gigneo_moderator_fields[] = Field::make( 'text', 'gigneo_ts_moderator_label', __( 'Moderator label', 'gigneo' ) )
							->set_default_value( sprintf( '%s Team', get_bloginfo( 'name' ) ) );

// Final filter and merge
$gigneo_moderator_fields = apply_filters( 'gigneo_ts_tab_other_section_moderator_fields', $gigneo_moderator_fields );
$gigneo_other_fields     = array_merge( $gigneo_other_fields, $gigneo_moderator_fields );

