<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <PreferenceCategory android:title="Client Connection">

        <club.clubk.ktag.apps.sharedservices.SummarizedEditTextPreference
            app:customHint="A name for this device"
            android:inputType="text"
            android:key="mqtt_device_id"
            android:summary="%s"
            android:title="Device ID" />

        <club.clubk.ktag.apps.sharedservices.SummarizedEditTextPreference
            app:customHint="Your assigned section of the MQTT server"
            android:inputType="text"
            android:key="mqtt_battlefield"
            android:summary="%s"
            android:title="KTag Battlefield" />

        <SwitchPreferenceCompat
            android:key="mqtt_autodiscovery"
            android:title="Autodiscovery"
            android:summary="Automatically find a broker on the local network"
            android:defaultValue="true" />

        <club.clubk.ktag.apps.sharedservices.SummarizedEditTextPreference
            app:customHint="ssl://mqtt.clubk.club:8883"
            android:inputType="textUri"
            android:key="mqtt_server_uri"
            android:summary="%s"
            android:title="KTag Server" />

        <club.clubk.ktag.apps.sharedservices.SummarizedEditTextPreference
            app:customHint="Enter your MQTT username"
            android:inputType="text"
            android:key="mqtt_username"
            android:summary="%s"
            android:title="Username" />

        <club.clubk.ktag.apps.sharedservices.SummarizedEditTextPreference
            app:customHint="Enter your MQTT password"
            android:inputType="textPassword"
            android:key="mqtt_password"
            android:summary="shh...it's a secret!"
            android:title="Password" />

    </PreferenceCategory>

    <PreferenceCategory android:title="Broker">

        <SwitchPreferenceCompat
            android:key="broker_enabled"
            android:title="Enable MQTT Broker"
            android:summary="Run an embedded MQTT broker on this device"
            android:defaultValue="false" />

    </PreferenceCategory>

    <PreferenceCategory android:title="Network">

        <EditTextPreference
            android:key="broker_port"
            android:title="MQTT Port"
            android:summary="Default: 1883"
            android:defaultValue="1883"
            android:inputType="number" />

        <EditTextPreference
            android:key="broker_ssl_port"
            android:title="SSL Port"
            android:summary="Default: 8883"
            android:defaultValue="8883"
            android:inputType="number"
            android:dependency="broker_ssl_enabled" />

    </PreferenceCategory>

    <PreferenceCategory android:title="Security">

        <SwitchPreferenceCompat
            android:key="broker_ssl_enabled"
            android:title="Enable SSL/TLS"
            android:summary="Use a self-signed certificate for encrypted connections"
            android:defaultValue="false" />

        <SwitchPreferenceCompat
            android:key="broker_auth_enabled"
            android:title="Enable Authentication"
            android:summary="Require username/password to connect"
            android:defaultValue="false" />

        <Preference
            android:key="broker_manage_users"
            android:title="Manage Users"
            android:summary="Add or remove user credentials"
            android:dependency="broker_auth_enabled" />

    </PreferenceCategory>

    <PreferenceCategory android:title="Discovery">

        <SwitchPreferenceCompat
            android:key="broker_nsd_enabled"
            android:title="Enable mDNS Discovery"
            android:summary="Advertise this broker on the local network"
            android:defaultValue="false" />

    </PreferenceCategory>

</PreferenceScreen>
