(function(exports) {
	const response_lenght = 10
	const queryTimeout = 1000
	exports.boards_count = 8
	exports.interface_count = 3
	exports.index_multiply = 0x100
	exports.can_nodes_count = 8
	exports.show_log_view = true

	//{ethernet: 0, master: 1, rs: 2, can: 3, rs_short: 4, rs_without_tcp: 5, iec104: 6}
	exports.network_interface_list = {
        0: [0, 2, 3, 6],
        1: [0, 6],
        2: [0, 2, 3, 6],
        3: [0, 2, 3, 6],
        4: [0, 2, 2, 6],
        5: [6],
        6: [5, 5, 6],
		7: [5, 3, 6],
	}
	exports.network_interface_list_EM_12T = {
		0: [0, 6],
        1: [0, 6],
        2: [0, 6],
        3: [0, 2, 2, 6],
        4: [0, 2, 3, 6],
        5: [6],
        6: [2, 2, 6],
		7: [2, 3, 6],
	}

	exports.data_type_template = function() { return data_type_template }
	exports.add_template = function(template)
	{
		data_type_template.templates.push(template)
	}
	let data_type_template = {"templates": [
		{"index": "1027_1","template": "combobox", "commands":  templates_commands.head_types()},
		{"index": "1027_2","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_3","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_4","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_5","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_6","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_7","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_8","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "1027_9","template": "module_types", "commands":  templates_commands.module_types()},
		{"index": "2081_1","template": "datetime"},
		{"index": "2081_12","template": "datetime_with_nanosec_simple"},
		{"index": "2002_1","template": "combobox", "commands":  templates_commands.access_commands_MCU_T_ETS()},
		{"index": "2001_9","template": "change_value", "commands":  templates_commands.access_values()},
		{"index": "2002_2","template": "password"},
		{"index": "1018_3","template": "ip_addr"},
		{"index": "2000_2","template": "ip_addr"},
		{"index": "2000_3","template": "ip_addr"},
		{"index": "2000_6","template": "ip_addr"},
		{"index": "2001_5","template": "battery"},
		{"index": "2001_12","template": "bit_value", "commands": templates_commands.hw_error_flags()},
		{"index": "2001_13","template": "bit_value", "commands": templates_commands.sw_error_flags()},
		{"index": "2001_15","template": "bit_value", "commands": templates_commands.hw_error_flags_2()},
		{"index": "2001_16","template": "bit_value", "commands": templates_commands.sw_error_flags()},
		{"index": "2101_5", "template": "change_value", "commands": templates_commands.CAN_port_status()},
		{"index": "2105_5", "template": "change_value", "commands": templates_commands.CAN_port_status()},
		{"index": "2109_5", "template": "change_value", "commands": templates_commands.CAN_port_status()},
		{"index": "2213_1","template": "combobox", "commands":  templates_commands.on_off_values()},
		{"index": "2213_2","template": "ip_addr"},
		{"index": "2213_3","template": "ip_addr"},
		{"index": "2213_4","template": "ip_addr"},
		{"index": "2213_5","template": "ip_addr"},
		{"index": "2213_6","template": "ip_addr"},
		{"index": "221B_2","template": "ip_addr need_restart"},
		{"index": "221B_3","template": "ip_addr"},
		{"index": "221B_4","template": "ip_addr"},
		{"index": "221B_5","template": "ip_addr"},
		{"index": "221B_6","template": "ip_addr"},
		{"index": "1011_1","template": "restore_params"},
		{"index": "5001_1","template": "change_value", "commands":  templates_commands.user_app_status()},
		{"index": "5000_2","template": "datetime_simple"},
		{"index": "5000_3","template": "ip_addr"},
	]}

	exports.get_multiply_templates = function() { return multiply_templates }
	exports.add_multiply_templates = function(template)
	{
		multiply_templates.push(template)
	}
	let multiply_templates = [{
		"type": "index multiply", 
		"count": exports.boards_count, 
		"multiply_coefficient": exports.index_multiply,
		"templates":[
		{"index": "4060_1","template": "combobox", "commands": templates_commands.connection_scheme()},
		{"index": "4060_2","template": "combobox", "commands": templates_commands.current_range()},
		{"index": "4060_3","template": "combobox", "commands": templates_commands.current_diff_range()},
		{"index": "4044_1","template": "combobox", "commands": templates_commands.on_off_values()},
		{"index": "4044_2","template": "combobox", "commands": templates_commands.on_off_values()},
		{"index": "4044_3","template": "combobox", "commands": templates_commands.on_off_values()},
		{"index": "4044_4","template": "combobox", "commands": templates_commands.on_off_values()},
		]},{
		"type": "index multiply", 
		"count": exports.interface_count, 
		"multiply_coefficient": 4,
		"templates":[
			{"index": "2143_1", "template": "boolean_type"},
			{"index": "2143_2", "template": "combobox", "commands": templates_commands.baudrate()},
			{"index": "2143_4", "template": "combobox", "commands": templates_commands.parity()},
			{"index": "2143_5", "template": "combobox", "commands": templates_commands.stopbits()},
			{"index": "2103_1", "template": "boolean_type"},
			{"index": "2103_2", "template": "combobox", "commands": templates_commands.CAN_speed()},
			{"index": "2333_1", "template": "boolean_type"},
			{"index": "2383_1", "template": "boolean_type"},
			{"index": "2323_1", "template": "boolean_type"},
			{"index": "2343_1","template": "boolean_type"},
	]}]

	exports.hide_fields_indexes = [
		//{type: "one_field", index: 0x2000, sub: 2},
		//{type: "one_field", index: 0x2000, sub: 3},
		{type: "one_field", index: 0x5000, sub: 3},
		//{type: "multy_sub", index: 0x0001, count: 5},
		//{type: "multy_index", index: 0x3F27, count: 10, index_multiply: 0x100},
		//{type: "multy_sub", index: 0x3F26, count: 5},
		//{type: "multy_index", index: 0x001, count: 10, index_multiply: 0x100},
	]
	
	//exports.module_types = function() { return module_types;}
	exports.response_lenght = function() { return response_lenght }
	exports.queryTimeout = function() { return queryTimeout }
	
})(this.configuration = {})
