//---------------------
//	Side Chat
//---------------------

[
	"milsim_sideChat",
	"CHECKBOX",
	"Side Chat Text Enabled",
	["17th Battalion", "Side Chat"],
	false,
	true,
	{
		params ["_value"];
		diag_log format["side chat activation set to %1", _value];
	}
] call CBA_fnc_addSetting;

["milsim_sideChat", false] call CBA_settings_fnc_set;

//---------------------
//	Server CPS
//---------------------

[
	"milsim_server_cps_enable",
	"CHECKBOX",
	"CPS Metrics Enabled",
	["17th Battalion", "Server Metrics"],
	true,
	true,
	{
		params ["_value"];
		diag_log format["server cps activation set to %1", _value];
	}
] call CBA_fnc_addSetting;

["milsim_server_cps_enable", true] call CBA_settings_fnc_set;

[
	"milsim_server_cps_interval",
	"TIME",
	"Metrics Interval",
	["17th Battalion", "Server Metrics"],
	[60,300,120],
	true,
	{
		if (!isServer) exitWith {};
		
		params ["_value"];
		diag_log format["server cps interval set to %1", _value];
		_cpsPFH = missionNamespace getVariable ["milsim_server_cps_handler", ObjNull];
		if (!isNull _cpsPFH) then {
			_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
		};

		_playerCpsPFH = missionNamespace getVariable ["milsim_player_cps_handler", ObjNull];
		if (!isNull _playerCpsPFH) then {
			_playerCpsPFH call CBA_fnc_deletePerFrameHandlerObject;
		};

		[] call milsim_fnc_addServerStatsPFH;

	}
] call CBA_fnc_addSetting;

//---------------------
//	Client CPS
//---------------------

[
	"milsim_client_cps_enable",
	"CHECKBOX",
	"CPS Metrics Enabled",
	["17th Battalion", "Client Metrics"],
	true,
	true,
	{
		params ["_value"];
		diag_log format["client cps activation set to %1", _value];
	}
] call CBA_fnc_addSetting;

["milsim_client_cps_enable", true] call CBA_settings_fnc_set;

[
	"milsim_client_cps_interval",
	"TIME",
	"CPS Metrics Interval",
	["17th Battalion", "Client Metrics"],
	[60,300,120],
	true,
	{
		if (!hasInterface) exitWith {};
		
		params ["_value"];
		diag_log format["client cps interval set to %1", _value];
		_cpsPFH = player getVariable ["milsim_client_cps_handler", ObjNull];
		if (!isNull _cpsPFH) then {
			_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
		};

		[] call milsim_fnc_addClientStatsPFH;

	}
] call CBA_fnc_addSetting;

//---------------------
//	Medical Overlay
//---------------------

[
	"milsim_client_medState3D_enabled", // variable
	"CHECKBOX", // type
	["Enable 3D Triage Card State", "Draws a colored dot over units within 10m indicating current ACE Triage State"], // title
	["17th Battalion", "Medical"], // category
	true // default value
] call CBA_fnc_addSetting;

[
	"milsim_client_medState3D_drawRange", // variable
	"LIST", // type
	["Range To Draw Icons", "Determines range at which dots are visible"], // title
	["17th Battalion", "Medical"], // category
	[[2, 4, 6, 8, 10], ["2", "4", "6", "8", "10"], 4] // option values, option labels, default index
] call CBA_fnc_addSetting;


diag_log text "[MILSIM] (settings) Custom CBA settings initialized";

nil;