version = "1.0"

[main]
name = "Configuration"

    [main.service]
    name = ""
    optional = false

        [main.service.no_antenna]
        # The value is filled via a custom getter
        type = "boolean"
        visible = "false"

        [main.service.no_antenna_alert]
        ask = "No wifi antenna has been detected! If you use a wifi USB dongle and that this one is not listed here, try to unplug and replug it, then reload this page."
        type = "alert"
        style = "danger"
        visible = "no_antenna"

        [main.service.status]
        ask = "The status of your Hotspot is unknown."
        type = "alert"
        style = "info"
        visible = "! no_antenna"

        [main.service.service_enabled]
        ask = "Enable Hotspot"
        type = "boolean"
        visible = "! no_antenna"

        [main.service.wifi_device]
        ask = "Device"
        type = "select"
        choices.wlan0 = "wlan0"
        visible = "! no_antenna"

        [main.service.wifi_channel]
        ask = "Channel"
        type = "select"
        choices.1 = "1"
        choices.2 = "2"
        choices.3 = "3"
        choices.4 = "4"
        choices.5 = "5"
        choices.6 = "6"
        choices.7 = "7"
        choices.8 = "8"
        choices.9 = "9"
        choices.10 = "10"
        choices.11 = "11"
        visible = "! no_antenna"
        help = "Changing the channel may help with signal strength depending on neighbour WiFis"

    [main.hotspot]
    name = "Hotspot"
    optional = false
    visible = "! no_antenna"

        [main.hotspot.wifi_ssid]
        ask = "Name (SSID)"
        type = "string"
        pattern.regexp = '^[\w \-]{1,32}$'
        pattern.error = "SSID in this app are limited to letter, number space, dash and underscores."

        [main.hotspot.wifi_secure]
        ask = "Secure"
        type = "boolean"

        [main.hotspot.wifi_passphrase]
        ask = "Password (WPA2)"
        type = "string"
        redact = true
        optional = true
        visible = "wifi_secure"
        pattern.regexp = '^[a-zA-Z0-9]{8,63}$'
        pattern.error = "Only printable alphanumeric characters are permitted in your password. Maximal size 63 chars"

        [main.hotspot.advanced]
        ask = "Advanced settings"
        type = "boolean"

        [main.hotspot.ip4_nat_prefix]
        ask = "IPv4 NAT prefix (/24)"
        type = "string"
        visible = "advanced"
        pattern.regexp = '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$'
        pattern.error = "Please provide a private /24 range in the format xxx.xxx.xxx"

        [main.hotspot.ip6_net]
        ask = "IPv6 delegated prefix"
        type = "string"
        optional = true
        visible = "advanced"
        pattern.regexp = '^[0-9a-fA-F:]+$'
        pattern.error = "Please provide a valid IPv6 Prefix"

        [main.hotspot.ip6_firewall]
        ask = "IPv6 firewall"
        type = "boolean"
        visible = "advanced"

        [main.hotspot.dns]
        ask = "DNS resolvers"
        type = "tags"
        bind = "null"
        visible = "advanced"
        pattern.regexp = '^([0-9.]{7,15}|[0-9a-fA-F:]+)$'
        pattern.error = "Not an ip"