{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/networkConnection.json",
    "type": "object",
    "title": "Network connection detail",
    "additionalProperties": false,
    "required": [
        "name",
        "type",
        "interface",
        "autoConnect",
        "ipv4",
        "ipv6"
    ],
    "properties": {
        "name": {
            "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/networkConnection.json#/definitions/name"
        },
        "uuid": {
            "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/networkConnection.json#/definitions/uuid"
        },
        "type": {
            "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/networkConnection.json#/definitions/type"
        },
        "interface": {
            "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/networkConnection.json#/definitions/interfaceName"
        },
        "autoConnect": {
            "type": "object",
            "title": "Automatic connecting",
            "example": {
                "enabled": true,
                "priority": 0,
                "retries": -1
            },
            "additionalProperties": false,
            "required": [
                "enabled",
                "priority",
                "retries"
            ],
            "properties": {
                "enabled": {
                    "type": "boolean",
                    "title": "Automatic connecting enablement",
                    "example": true
                },
                "priority": {
                    "type": "integer",
                    "title": "Connection priority",
                    "minimum": -999,
                    "maximum": 999,
                    "example": 0
                },
                "retries": {
                    "type": "integer",
                    "title": "Connection retries",
                    "minimum": -1,
                    "maximum": 2147483647,
                    "example": -1
                }
            }
        },
        "ipv4": {
            "type": "object",
            "title": "IPv4 connection",
            "description": "Constraints follow NetworkManager: addresses and DNS servers are not allowed for disabled and link-local methods, DNS servers are not allowed for shared method, manual method requires at least one address and gateway requires at least one address.",
            "example": {
                "dns": [
                    {
                        "address": "192.168.1.1"
                    }
                ],
                "addresses": [
                    {
                        "prefix": 24,
                        "address": "192.168.1.198"
                    }
                ],
                "gateway": "192.168.1.1",
                "method": "manual"
            },
            "additionalProperties": false,
            "required": [
                "method",
                "addresses",
                "gateway",
                "dns"
            ],
            "allOf": [
                {
                    "if": {
                        "properties": {
                            "method": {
                                "enum": [
                                    "disabled",
                                    "link-local"
                                ]
                            }
                        },
                        "required": [
                            "method"
                        ]
                    },
                    "then": {
                        "properties": {
                            "addresses": {
                                "maxItems": 0
                            },
                            "dns": {
                                "maxItems": 0
                            }
                        }
                    }
                },
                {
                    "if": {
                        "properties": {
                            "method": {
                                "enum": [
                                    "shared"
                                ]
                            }
                        },
                        "required": [
                            "method"
                        ]
                    },
                    "then": {
                        "properties": {
                            "dns": {
                                "maxItems": 0
                            }
                        }
                    }
                },
                {
                    "if": {
                        "properties": {
                            "method": {
                                "enum": [
                                    "manual"
                                ]
                            }
                        },
                        "required": [
                            "method"
                        ]
                    },
                    "then": {
                        "properties": {
                            "addresses": {
                                "minItems": 1
                            }
                        }
                    }
                },
                {
                    "if": {
                        "properties": {
                            "gateway": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "gateway"
                        ]
                    },
                    "then": {
                        "properties": {
                            "addresses": {
                                "minItems": 1
                            }
                        }
                    }
                }
            ],
            "properties": {
                "method": {
                    "$ref": "#/definitions/ipv4/method"
                },
                "addresses": {
                    "$ref": "#/definitions/ipv4/addresses"
                },
                "gateway": {
                    "$ref": "#/definitions/ipv4/gateway"
                },
                "dns": {
                    "$ref": "#/definitions/ipv4/dns"
                },
                "current": {
                    "title": "Current (in-use) IPv4 connection configuration",
                    "type": "object",
                    "required": [
                        "method",
                        "addresses",
                        "gateway",
                        "dns"
                    ],
                    "additionalProperties": false,
                    "properties": {
                        "method": {
                            "$ref": "#/definitions/ipv4/method"
                        },
                        "addresses": {
                            "$ref": "#/definitions/ipv4/addresses"
                        },
                        "gateway": {
                            "$ref": "#/definitions/ipv4/gateway"
                        },
                        "dns": {
                            "$ref": "#/definitions/ipv4/dns"
                        }
                    }
                }
            }
        },
        "ipv6": {
            "type": "object",
            "title": "IPv6 connection",
            "description": "Constraints follow NetworkManager: addresses and DNS servers are not allowed for disabled, ignore and link-local methods, manual method requires at least one address and gateway requires at least one address.",
            "example": {
                "method": "manual",
                "addresses": [
                    {
                        "prefix": 64,
                        "address": "2001:470:5bb2::671"
                    }
                ],
                "gateway": "fe80::6f0:21ff:fe24:1e53",
                "dns": [
                    {
                        "address": "2606:4700:4700::1111"
                    }
                ]
            },
            "additionalProperties": false,
            "required": [
                "method",
                "addresses",
                "gateway",
                "dns"
            ],
            "allOf": [
                {
                    "if": {
                        "properties": {
                            "method": {
                                "enum": [
                                    "disabled",
                                    "ignore",
                                    "link-local"
                                ]
                            }
                        },
                        "required": [
                            "method"
                        ]
                    },
                    "then": {
                        "properties": {
                            "addresses": {
                                "maxItems": 0
                            },
                            "dns": {
                                "maxItems": 0
                            }
                        }
                    }
                },
                {
                    "if": {
                        "properties": {
                            "method": {
                                "enum": [
                                    "manual"
                                ]
                            }
                        },
                        "required": [
                            "method"
                        ]
                    },
                    "then": {
                        "properties": {
                            "addresses": {
                                "minItems": 1
                            }
                        }
                    }
                },
                {
                    "if": {
                        "properties": {
                            "gateway": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "gateway"
                        ]
                    },
                    "then": {
                        "properties": {
                            "addresses": {
                                "minItems": 1
                            }
                        }
                    }
                }
            ],
            "properties": {
                "method": {
                    "$ref": "#/definitions/ipv6/method"
                },
                "addresses": {
                    "$ref": "#/definitions/ipv6/addresses"
                },
                "gateway": {
                    "$ref": "#/definitions/ipv6/gateway"
                },
                "dns": {
                    "$ref": "#/definitions/ipv6/dns"
                },
                "current": {
                    "title": "Current (in-use) IPv6 connection configuration",
                    "type": "object",
                    "required": [
                        "method",
                        "addresses",
                        "gateway",
                        "dns"
                    ],
                    "additionalProperties": false,
                    "properties": {
                        "method": {
                            "$ref": "#/definitions/ipv6/method"
                        },
                        "addresses": {
                            "$ref": "#/definitions/ipv6/addresses"
                        },
                        "gateway": {
                            "$ref": "#/definitions/ipv6/gateway"
                        },
                        "dns": {
                            "$ref": "#/definitions/ipv6/dns"
                        }
                    }
                }
            }
        },
        "wifi": {
            "type": "object",
            "title": "WiFi connection",
            "example": {
                "ssid": "WIFI MAGDA",
                "mode": "infrastructure",
                "security": {
                    "type": "wpa-psk",
                    "psk": "password"
                }
            },
            "additionalProperties": false,
            "required": [
                "ssid",
                "mode",
                "security"
            ],
            "properties": {
                "bssids": {
                    "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/networkConnection.json#/definitions/wifi/bssids"
                },
                "ssid": {
                    "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/networkConnection.json#/definitions/wifi/ssid"
                },
                "mode": {
                    "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/networkConnection.json#/definitions/wifi/mode"
                },
                "security": {
                    "type": [
                        "object",
                        "null"
                    ],
                    "title": "WiFi connection security",
                    "description": "null = security is not configured",
                    "example": {
                        "type": "wpa-psk",
                        "psk": "password"
                    },
                    "additionalProperties": false,
                    "required": [
                        "type"
                    ],
                    "properties": {
                        "eap": {
                            "type": "object",
                            "title": "EAP",
                            "additionalProperties": false,
                            "required": [
                                "phaseOneMethod",
                                "phaseTwoMethod",
                                "identity",
                                "password"
                            ],
                            "properties": {
                                "anonymousIdentity": {
                                    "type": "string",
                                    "title": "EAP anonymous identity",
                                    "example": "anonymous"
                                },
                                "cert": {
                                    "type": "string",
                                    "title": "Path to the CA certificate used to verify the authentication server",
                                    "pattern": "^(/.*)?$",
                                    "example": "/etc/ssl/certs/radius-ca.pem"
                                },
                                "clientCert": {
                                    "type": "string",
                                    "title": "Path to the client certificate (EAP-TLS)",
                                    "pattern": "^(/.*)?$",
                                    "example": "/etc/ssl/certs/client.pem"
                                },
                                "domainMatch": {
                                    "type": "array",
                                    "title": "Domains, one of them has to match the authentication server certificate exactly",
                                    "uniqueItems": true,
                                    "items": {
                                        "type": "string",
                                        "title": "Domain name",
                                        "maxLength": 253,
                                        "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$"
                                    },
                                    "example": [
                                        "radius1.example.com",
                                        "radius2.example.com"
                                    ]
                                },
                                "domainSuffixMatch": {
                                    "type": "array",
                                    "title": "Domain suffixes, one of them has to match the authentication server certificate",
                                    "uniqueItems": true,
                                    "items": {
                                        "type": "string",
                                        "title": "Domain name",
                                        "maxLength": 253,
                                        "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$"
                                    },
                                    "example": [
                                        "example.com"
                                    ]
                                },
                                "identity": {
                                    "type": "string",
                                    "title": "EAP identity",
                                    "example": "username"
                                },
                                "password": {
                                    "type": "string",
                                    "title": "EAP password",
                                    "example": "password"
                                },
                                "privateKey": {
                                    "type": "string",
                                    "title": "Path to the client private key (EAP-TLS)",
                                    "pattern": "^(/.*)?$",
                                    "example": "/etc/ssl/private/client.key"
                                },
                                "privateKeyPassword": {
                                    "type": "string",
                                    "title": "Client private key password (EAP-TLS)",
                                    "example": "password"
                                },
                                "systemCaCerts": {
                                    "type": "boolean",
                                    "title": "Use the system CA certificates to verify the authentication server",
                                    "example": false
                                },
                                "phaseOneMethod": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "title": "EAP phase one method",
                                    "enum": [
                                        "fast",
                                        "leap",
                                        "md5",
                                        "peap",
                                        "pwd",
                                        "tls",
                                        "ttls",
                                        null
                                    ],
                                    "example": "peap"
                                },
                                "phaseTwoMethod": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "title": "EAP phase two method",
                                    "enum": [
                                        "chap",
                                        "gtc",
                                        "md5",
                                        "mschap",
                                        "mschapv2",
                                        "pap",
                                        "eap-gtc",
                                        "eap-md5",
                                        "eap-mschapv2",
                                        null
                                    ],
                                    "description": "Values with the \"eap-\" prefix are inner EAP methods of EAP-TTLS",
                                    "example": "mschapv2"
                                }
                            },
                            "anyOf": [
                                {
                                    "title": "PEAP - identity and password are required",
                                    "required": [
                                        "phaseOneMethod",
                                        "phaseTwoMethod",
                                        "identity",
                                        "password"
                                    ],
                                    "properties": {
                                        "phaseOneMethod": {
                                            "const": "peap"
                                        },
                                        "phaseTwoMethod": {
                                            "enum": [
                                                "gtc",
                                                "md5",
                                                "mschapv2"
                                            ]
                                        },
                                        "identity": {
                                            "minLength": 1
                                        },
                                        "password": {
                                            "minLength": 1
                                        }
                                    }
                                },
                                {
                                    "title": "EAP-TTLS - identity and password are required",
                                    "required": [
                                        "phaseOneMethod",
                                        "phaseTwoMethod",
                                        "identity",
                                        "password"
                                    ],
                                    "properties": {
                                        "phaseOneMethod": {
                                            "const": "ttls"
                                        },
                                        "phaseTwoMethod": {
                                            "enum": [
                                                "chap",
                                                "mschap",
                                                "mschapv2",
                                                "pap",
                                                "eap-gtc",
                                                "eap-md5",
                                                "eap-mschapv2"
                                            ]
                                        },
                                        "identity": {
                                            "minLength": 1
                                        },
                                        "password": {
                                            "minLength": 1
                                        }
                                    }
                                },
                                {
                                    "title": "EAP-TLS - identity, client certificate and private key are required",
                                    "required": [
                                        "phaseOneMethod",
                                        "phaseTwoMethod",
                                        "identity",
                                        "clientCert",
                                        "privateKey"
                                    ],
                                    "properties": {
                                        "phaseOneMethod": {
                                            "const": "tls"
                                        },
                                        "phaseTwoMethod": {
                                            "type": "null"
                                        },
                                        "identity": {
                                            "minLength": 1
                                        },
                                        "clientCert": {
                                            "minLength": 1
                                        },
                                        "privateKey": {
                                            "minLength": 1
                                        }
                                    }
                                },
                                {
                                    "title": "EAP-PWD - identity and password are required",
                                    "required": [
                                        "phaseOneMethod",
                                        "phaseTwoMethod",
                                        "identity",
                                        "password"
                                    ],
                                    "properties": {
                                        "phaseOneMethod": {
                                            "const": "pwd"
                                        },
                                        "phaseTwoMethod": {
                                            "type": "null"
                                        },
                                        "identity": {
                                            "minLength": 1
                                        },
                                        "password": {
                                            "minLength": 1
                                        }
                                    }
                                },
                                {
                                    "title": "Other EAP methods (not configurable in the web interface)",
                                    "properties": {
                                        "phaseOneMethod": {
                                            "enum": [
                                                "fast",
                                                "leap",
                                                "md5",
                                                null
                                            ]
                                        },
                                        "phaseTwoMethod": {
                                            "enum": [
                                                "chap",
                                                "gtc",
                                                "md5",
                                                "mschap",
                                                "mschapv2",
                                                "pap",
                                                null
                                            ]
                                        }
                                    }
                                }
                            ]
                        },
                        "type": {
                            "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/networkConnection.json#/definitions/wifi/security/type"
                        },
                        "leap": {
                            "type": "object",
                            "title": "Cisco LEAP",
                            "additionalProperties": false,
                            "required": [
                                "username",
                                "password"
                            ],
                            "properties": {
                                "username": {
                                    "type": "string",
                                    "title": "Cisco LEAP username",
                                    "example": "username"
                                },
                                "password": {
                                    "type": "string",
                                    "title": "Cisco LEAP password",
                                    "example": "password"
                                }
                            }
                        },
                        "wep": {
                            "type": "object",
                            "title": "WEP",
                            "additionalProperties": false,
                            "required": [
                                "type",
                                "index",
                                "keys"
                            ],
                            "properties": {
                                "type": {
                                    "type": "string",
                                    "title": "WEP key type",
                                    "enum": [
                                        "key",
                                        "passphrase",
                                        "unknown"
                                    ],
                                    "example": "key"
                                },
                                "index": {
                                    "type": "integer",
                                    "title": "WEP transfer key index",
                                    "minimum": 0,
                                    "maximum": 3,
                                    "example": 0
                                },
                                "keys": {
                                    "type": "array",
                                    "title": "WEP keys",
                                    "minItems": 4,
                                    "maxItems": 4,
                                    "items": {
                                        "type": "string",
                                        "title": "WEP key",
                                        "example": "4b70797e57534a5c4833493352"
                                    }
                                }
                            }
                        },
                        "psk": {
                            "type": "string",
                            "title": "Pre-shared key",
                            "example": "password"
                        }
                    },
                    "allOf": [
                        {
                            "if": {
                                "properties": {
                                    "type": {
                                        "const": "wpa-eap-suite-b-192"
                                    }
                                },
                                "required": [
                                    "type"
                                ]
                            },
                            "then": {
                                "required": [
                                    "eap"
                                ]
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "type": {
                                        "const": "wpa-eap"
                                    }
                                },
                                "required": [
                                    "type"
                                ]
                            },
                            "then": {
                                "required": [
                                    "eap"
                                ]
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "type": {
                                        "const": "leap"
                                    }
                                },
                                "required": [
                                    "type"
                                ]
                            },
                            "then": {
                                "required": [
                                    "leap"
                                ]
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "type": {
                                        "const": "wep"
                                    }
                                },
                                "required": [
                                    "type"
                                ]
                            },
                            "then": {
                                "required": [
                                    "wep"
                                ]
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "type": {
                                        "const": "wpa-psk"
                                    }
                                },
                                "required": [
                                    "type"
                                ]
                            },
                            "then": {
                                "required": [
                                    "psk"
                                ]
                            }
                        },
                        {
                            "if": {
                                "properties": {
                                    "type": {
                                        "const": "sae"
                                    }
                                },
                                "required": [
                                    "type"
                                ]
                            },
                            "then": {
                                "required": [
                                    "psk"
                                ]
                            }
                        }
                    ]
                }
            }
        },
        "gsm": {
            "title": "GSM connection",
            "type": "object",
            "example": {
                "apn": "internet",
                "autoConfig": false,
                "homeOnly": false,
                "pin": "1234",
                "username": "gsmuser",
                "password": "gsmpassword"
            },
            "required": [
                "apn",
                "autoConfig",
                "homeOnly",
                "pin",
                "username",
                "password"
            ],
            "additionalProperties": false,
            "properties": {
                "apn": {
                    "title": "Access point name",
                    "type": [
                        "string",
                        "null"
                    ],
                    "example": "internet"
                },
                "autoConfig": {
                    "title": "Use APN, username and password from the mobile broadband provider database",
                    "type": "boolean",
                    "example": false
                },
                "homeOnly": {
                    "title": "Allow connection only to the home network (disable roaming)",
                    "type": "boolean",
                    "example": false
                },
                "pin": {
                    "title": "SIM PIN",
                    "type": [
                        "string",
                        "null"
                    ],
                    "oneOf": [
                        {
                            "pattern": "^\\d{4,8}$"
                        },
                        {
                            "const": ""
                        }
                    ],
                    "example": "1234"
                },
                "username": {
                    "title": "Username",
                    "type": [
                        "string",
                        "null"
                    ],
                    "example": "gsmuser"
                },
                "password": {
                    "title": "Password",
                    "type": [
                        "string",
                        "null"
                    ],
                    "example": "gsmpassword"
                }
            },
            "anyOf": [
                {
                    "title": "Automatic configuration - APN and credentials are taken from the mobile broadband provider database",
                    "properties": {
                        "autoConfig": {
                            "const": true
                        },
                        "apn": {
                            "type": "null"
                        },
                        "username": {
                            "type": "null"
                        },
                        "password": {
                            "type": "null"
                        }
                    }
                },
                {
                    "title": "Manual configuration - APN is required",
                    "properties": {
                        "autoConfig": {
                            "const": false
                        },
                        "apn": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9.-]+$"
                        }
                    }
                }
            ]
        },
        "serial": {
            "title": "Serial link connection",
            "type": "object",
            "example": {
                "baudRate": 57600,
                "bits": 8,
                "parity": "none",
                "sendDelay": 0,
                "stopBits": 1
            },
            "required": [
                "baudRate",
                "bits",
                "parity",
                "sendDelay",
                "stopBits"
            ],
            "additionalProperties": false,
            "properties": {
                "baudRate": {
                    "title": "Baud rate",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 4294967295,
                    "example": 57600
                },
                "bits": {
                    "title": "Byte-width",
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 8,
                    "example": 8
                },
                "parity": {
                    "title": "Parity",
                    "type": "string",
                    "enum": [
                        "even",
                        "odd",
                        "none"
                    ],
                    "example": "none"
                },
                "sendDelay": {
                    "title": "Delay between bytes in microseconds",
                    "type": "integer",
                    "minimum": 0,
                    "maximum": "18446744073709551615",
                    "example": 0
                },
                "stopBits": {
                    "title": "Stop bits",
                    "type": "integer",
                    "enum": [
                        1,
                        2
                    ]
                }
            }
        },
        "vlan": {
            "title": "VLAN configuration",
            "type": "object",
            "example": {
                "parentInterface": "eth0",
                "id": 10,
                "flags": {
                    "reorderHeaders": true,
                    "gvrp": false,
                    "looseBinding": false,
                    "mvrp": false
                }
            },
            "required": [
                "parentInterface",
                "id",
                "flags"
            ],
            "additionalProperties": false,
            "properties": {
                "parentInterface": {
                    "title": "Parent Ethernet interface",
                    "type": "string",
                    "example": "eth0"
                },
                "id": {
                    "title": "VLAN ID",
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 4094,
                    "example": 10
                },
                "flags": {
                    "title": "VLAN flags",
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                        "reorderHeaders",
                        "gvrp",
                        "looseBinding",
                        "mvrp"
                    ],
                    "properties": {
                        "reorderHeaders": {
                            "title": "Reorder headers",
                            "type": "boolean",
                            "example": true
                        },
                        "gvrp": {
                            "title": "GVRP",
                            "type": "boolean",
                            "example": false
                        },
                        "looseBinding": {
                            "title": "Loose binding",
                            "type": "boolean",
                            "example": false
                        },
                        "mvrp": {
                            "title": "MVRP",
                            "type": "boolean",
                            "example": false
                        }
                    },
                    "example": {
                        "reorderHeaders": true,
                        "gvrp": false,
                        "looseBinding": false,
                        "mvrp": false
                    }
                }
            }
        },
        "wireGuard": {
            "title": "WireGuard tunnel configuration",
            "type": "object",
            "example": {
                "privateKey": "uHjCXprATG+woFX/i2a6WxcVb6t0CUnC5x/CbQWWpU0=",
                "listenPort": 0,
                "peers": [
                    {
                        "publicKey": "9NuqIH/JQesoW8RJnffkz6zyGoeXkuO03mFRl4EohWI=",
                        "endpoint": {
                            "address": "vpn.example.com",
                            "port": 51820
                        },
                        "allowedIps": [
                            {
                                "address": "10.0.0.0",
                                "prefix": 24
                            },
                            {
                                "address": "fd86:ea04:1115::",
                                "prefix": 64
                            }
                        ],
                        "persistentKeepalive": 25,
                        "psk": null
                    }
                ],
                "mtu": null
            },
            "required": [
                "privateKey",
                "listenPort",
                "peers",
                "mtu"
            ],
            "additionalProperties": false,
            "properties": {
                "privateKey": {
                    "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/wireGuard.json#/definitions/privateKey"
                },
                "listenPort": {
                    "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/wireGuard.json#/definitions/port"
                },
                "peers": {
                    "$ref": "#/definitions/wireGuard/peers"
                },
                "mtu": {
                    "oneOf": [
                        {
                            "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/wireGuard.json#/definitions/mtu"
                        },
                        {
                            "type": "null"
                        }
                    ]
                }
            }
        }
    },
    "allOf": [
        {
            "if": {
                "properties": {
                    "type": {
                        "const": "802-11-wireless"
                    }
                },
                "required": [
                    "type"
                ]
            },
            "then": {
                "required": [
                    "wifi"
                ]
            }
        },
        {
            "if": {
                "properties": {
                    "type": {
                        "const": "gsm"
                    }
                },
                "required": [
                    "type"
                ]
            },
            "then": {
                "required": [
                    "gsm"
                ]
            }
        },
        {
            "if": {
                "properties": {
                    "type": {
                        "const": "vlan"
                    }
                },
                "required": [
                    "type"
                ]
            },
            "then": {
                "required": [
                    "vlan"
                ]
            }
        },
        {
            "if": {
                "properties": {
                    "type": {
                        "const": "wireguard"
                    }
                },
                "required": [
                    "type"
                ]
            },
            "then": {
                "required": [
                    "wireGuard"
                ]
            }
        }
    ],
    "definitions": {
        "ipv4": {
            "method": {
                "title": "IPv4 connection method",
                "type": "string",
                "example": "manual",
                "enum": [
                    "auto",
                    "disabled",
                    "link-local",
                    "manual",
                    "shared"
                ]
            },
            "addresses": {
                "title": "IPv4 addresses",
                "type": "array",
                "uniqueItems": true,
                "items": {
                    "title": "IPv4 address",
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                        "address",
                        "prefix"
                    ],
                    "properties": {
                        "address": {
                            "title": "IPv4 address",
                            "type": "string",
                            "format": "ipv4",
                            "example": "192.168.1.198"
                        },
                        "prefix": {
                            "title": "IPv4 network prefix",
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 32,
                            "example": 24
                        }
                    },
                    "example": {
                        "address": "192.168.1.198",
                        "prefix": 24
                    }
                },
                "example": [
                    {
                        "prefix": 24,
                        "address": "192.168.1.198"
                    }
                ]
            },
            "gateway": {
                "title": "IPv4 gateway address",
                "description": "null = no gateway, unspecified address is not allowed",
                "type": [
                    "string",
                    "null"
                ],
                "format": "ipv4",
                "not": {
                    "title": "Unspecified IPv4 address",
                    "type": "string",
                    "pattern": "^[0.]+$"
                },
                "example": "192.168.1.1"
            },
            "dns": {
                "title": "DNS IPv4 addresses",
                "type": "array",
                "uniqueItems": true,
                "items": {
                    "title": "DNS IPv4 address",
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                        "address"
                    ],
                    "properties": {
                        "address": {
                            "title": "IPv4 address",
                            "type": "string",
                            "format": "ipv4",
                            "example": "1.1.1.1"
                        }
                    },
                    "example": {
                        "address": "192.168.1.1"
                    }
                },
                "example": [
                    {
                        "address": "192.168.1.1"
                    }
                ]
            }
        },
        "ipv6": {
            "method": {
                "title": "IPv6 connection method",
                "type": "string",
                "enum": [
                    "auto",
                    "disabled",
                    "dhcp",
                    "ignore",
                    "link-local",
                    "manual",
                    "shared"
                ],
                "example": "manual"
            },
            "addresses": {
                "title": "IPv6 addresses",
                "type": "array",
                "uniqueItems": true,
                "items": {
                    "title": "IPv6 address",
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                        "address",
                        "prefix"
                    ],
                    "properties": {
                        "address": {
                            "title": "IPv6 address",
                            "type": "string",
                            "format": "ipv6",
                            "example": "2001:470:5bb2::671"
                        },
                        "prefix": {
                            "title": "IPv6 network prefix",
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 128,
                            "example": 64
                        }
                    },
                    "examples": [
                        {
                            "prefix": 64,
                            "address": "2001:470:5bb2::671"
                        }
                    ]
                },
                "example": [
                    {
                        "prefix": 64,
                        "address": "2001:470:5bb2::671"
                    }
                ]
            },
            "gateway": {
                "title": "IPv6 gateway address",
                "description": "null = no gateway, unspecified address is not allowed",
                "type": [
                    "string",
                    "null"
                ],
                "format": "ipv6",
                "not": {
                    "title": "Unspecified IPv6 address",
                    "type": "string",
                    "pattern": "^[0:.]+$"
                },
                "example": "fe80::6f0:21ff:fe24:1e53"
            },
            "dns": {
                "title": "DNS IPv6 addresses",
                "type": "array",
                "uniqueItems": true,
                "items": {
                    "title": "DNS IPv6 address",
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                        "address"
                    ],
                    "properties": {
                        "address": {
                            "title": "IPv6 address",
                            "type": "string",
                            "format": "ipv6",
                            "example": "2606:4700:4700::1111"
                        }
                    },
                    "example": {
                        "address": "2606:4700:4700::1111"
                    }
                },
                "example": [
                    {
                        "address": "2606:4700:4700::1111"
                    }
                ]
            }
        },
        "wireGuard": {
            "peers": {
                "title": "WireGuard tunnel peers",
                "type": "array",
                "uniqueItems": true,
                "items": {
                    "title": "WireGuard tunnel peer",
                    "type": "object",
                    "required": [
                        "publicKey",
                        "endpoint",
                        "allowedIps",
                        "persistentKeepalive"
                    ],
                    "additionalProperties": false,
                    "properties": {
                        "publicKey": {
                            "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/wireGuard.json#/definitions/publicKey"
                        },
                        "endpoint": {
                            "title": "WireGuard tunnel peer endpoint",
                            "description": "null = peer without endpoint (e.g. a client connecting to this gateway)",
                            "type": [
                                "object",
                                "null"
                            ],
                            "required": [
                                "address",
                                "port"
                            ],
                            "additionalProperties": false,
                            "properties": {
                                "address": {
                                    "title": "WireGuard tunnel peer endpoint address",
                                    "description": "Hostname, IPv4 address or IPv6 address (without brackets)",
                                    "type": "string",
                                    "anyOf": [
                                        {
                                            "format": "hostname"
                                        },
                                        {
                                            "format": "ipv4"
                                        },
                                        {
                                            "format": "ipv6"
                                        }
                                    ],
                                    "example": "vpn.example.com"
                                },
                                "port": {
                                    "title": "WireGuard tunnel peer endpoint port",
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 65535,
                                    "example": 51820
                                }
                            }
                        },
                        "allowedIps": {
                            "title": "WireGuard tunnel peer allowed IP addresses",
                            "type": "array",
                            "uniqueItems": true,
                            "items": {
                                "oneOf": [
                                    {
                                        "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/wireGuard.json#/definitions/ipv4"
                                    },
                                    {
                                        "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/wireGuard.json#/definitions/ipv6"
                                    }
                                ]
                            }
                        },
                        "persistentKeepalive": {
                            "title": "WireGuard tunnel peer persistent keepalive interval in seconds",
                            "description": "null or 0 = persistent keepalive is disabled",
                            "type": [
                                "integer",
                                "null"
                            ],
                            "minimum": 0,
                            "maximum": 65535,
                            "example": 25
                        },
                        "psk": {
                            "$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/latest/schemas/definitions/wireGuard.json#/definitions/psk"
                        }
                    }
                }
            },
            "mtu": {
                "title": "WireGuard interface MTU",
                "description": "null = automatic MTU",
                "type": [
                    "integer",
                    "null"
                ],
                "minimum": 1,
                "maximum": 65535,
                "example": 1420
            }
        }
    }
}
