<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
	xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0
	https://openhab.org/schemas/config-description-1.0.0.xsd">

	<config-description uri="mqtt:systemBrokerConnectionInstance">

		<parameter-group name="group_connection">
			<label>Connection</label>
			<description>A group of connection parameters.</description>
		</parameter-group>
		<parameter-group name="group_message_params">
			<label>Message</label>
			<description>All message parameters.</description>
			<advanced>true</advanced>
		</parameter-group>
		<parameter-group name="group_lastwill_params">
			<label>Last Will</label>
			<description>All last-will parameters.</description>
			<advanced>true</advanced>
		</parameter-group>

		<parameter name="name" type="text" groupName="group_connection">
			<label>Connection Name</label>
			<description>A connection name helps to identify a broker connection. If nothing is set, an automatic name based on
				the host and port will be generated.</description>
		</parameter>
		<parameter name="host" type="text" required="true" groupName="group_connection">
			<label>Broker Host</label>
			<description>Hostname or IP of the broker.</description>
		</parameter>
		<parameter name="port" type="integer" min="1" max="65535" groupName="group_connection">
			<label>Broker Port</label>
			<description>A custom broker connection port. Leave empty to use the default MQTT ports for secure or non-secure
				connections.</description>
			<advanced>true</advanced>
		</parameter>
		<parameter name="secure" type="boolean" required="true" groupName="group_connection">
			<label>Secure Connection?</label>
			<description>A broker connection is either a non-secure TCP connection or a TLS secure connection.</description>
			<default>false</default>
		</parameter>
		<parameter name="hostnameValidated" type="boolean" required="true" groupName="group_connection">
			<label>Hostname Validated?</label>
			<description>For a secure TLS connection, defines if the server hostname is validated against the hostname in the
				certificate.</description>
			<default>true</default>
		</parameter>
		<parameter name="username" type="text" groupName="group_connection">
			<label>Broker Username</label>
			<description>Broker username.</description>
		</parameter>
		<parameter name="password" type="text" groupName="group_connection">
			<label>Broker Password</label>
			<description>Broker password.</description>
			<context>password</context>
		</parameter>
		<parameter name="clientID" type="text" groupName="group_connection">
			<label>Client ID</label>
			<description>An optional client ID used for this connection.</description>
			<advanced>true</advanced>
		</parameter>
		<parameter name="keepAlive" type="integer" unit="s" groupName="group_connection">
			<label>Keep-Alive</label>
			<description>Keep-alive timer in seconds. A too frequent timer could conquest the network / spam the MQTT server, a
				too low value might risk that a broken connection is detected very late.</description>
			<default>60</default>
			<advanced>true</advanced>
		</parameter>
		<parameter name="qos" type="integer" groupName="group_message_params">
			<label>Quality of Service</label>
			<description>The Quality of Service (QoS) level is an agreement between sender and receiver of a message regarding
				the guarantees of delivering a message.</description>
			<options>
				<option value="0">At most once (best effort delivery "fire and forget")</option>
				<option value="1">At least once (guaranteed that a message will be delivered at least once)</option>
				<option value="2">Exactly once (guarantees that each message is received only once by the counterpart)</option>
			</options>
			<default>0</default>
		</parameter>
		<parameter name="retainMessages" type="boolean" groupName="group_message_params">
			<label>Retain Messages</label>
			<description>Messages send by this connection are retained</description>
			<default>false</default>
		</parameter>
		<parameter name="lwtTopic" type="text" groupName="group_lastwill_params">
			<label>Last Will - Topic</label>
			<description>When the connection dies, the last-will is performed by the MQTT server. This is the last-will topic. It
				must be set to perform a last-will.</description>
		</parameter>
		<parameter name="lwtMessage" type="text" groupName="group_lastwill_params">
			<label>Last Will - Message</label>
			<description>When the connection dies, the last-will is performed by the MQTT server. This is the last-will message.
				Can be empty.</description>
		</parameter>
		<parameter name="lwtQos" type="integer" groupName="group_lastwill_params">
			<label>Last Will - Quality of Service</label>
			<description>The Quality of Service (QoS) level is an agreement between sender and receiver of a message regarding
				the guarantees of delivering a message.</description>
			<options>
				<option value="0">At most once (best effort delivery "fire and forget")</option>
				<option value="1">At least once (guaranteed that a message will be delivered at least once)</option>
				<option value="2">Exactly once (guarantees that each message is received only once by the counterpart)</option>
			</options>
			<default>0</default>
		</parameter>
		<parameter name="lwtRetain" type="boolean" groupName="group_lastwill_params">
			<label>Last Will - Retain Message</label>
			<description>When the connection dies, the last-will is performed by the MQTT server. If retain message is checked,
				the message will be retained by the MQTT server.</description>
			<default>false</default>
		</parameter>

	</config-description>
</config-description:config-descriptions>
