{
	"$schema": "http://json-schema.org/draft-07/schema",
	"$id": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/schemas/definitions/wireGuard.json",
	"definitions": {
		"ipv4": {
			"$id": "#/definitions/ipv4",
			"type": "object",
			"title": "WireGuard IPv4 configuration",
			"examples": [
				{
					"address": "10.0.0.0",
					"prefix": 24
				}
			],
			"required": [
				"address",
				"prefix"
			],
			"additionalProperties": false,
			"properties": {
				"address": {
					"$id": "#/definitions/ipv4/properties/address",
					"title": "WireGuard IPv4 address",
					"type": "string",
					"format": "ipv4",
					"example": "10.0.0.35"
				},
				"prefix": {
					"$id": "#/definitions/ipv4/properties/prefix",
					"title": "WireGuard IPv4 address prefix",
					"type": "integer",
					"minimum": 0,
					"maximum": 32,
					"example": 24
				}
			}
		},
		"ipv6": {
			"$id": "#/definitions/ipv6",
			"type": "object",
			"title": "WireGuard IPv6 configuration",
			"examples": [
				{
					"address": "fd86:ea04:1115::35",
					"prefix": 64
				}
			],
			"required": [
				"address",
				"prefix"
			],
			"additionalProperties": false,
			"properties": {
				"address": {
					"$id": "#/definitions/ipv6/properties/address",
					"title": "WireGuard IPv6 address",
					"type": "string",
					"format": "ipv6",
					"example": "fd86:ea04:1115::35"
				},
				"prefix": {
					"$id": "#/definitions/ipv6/properties/prefix",
					"title": "WireGuard IPv6 address prefix",
					"type": "integer",
					"minimum": 0,
					"maximum": 128,
					"example": 64
				}
			}
		},
		"privateKey": {
			"$id": "#/definitions/privateKey",
			"type": "string",
			"pattern": "^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw480]=$",
			"title": "WireGuard private key",
			"example": "+DsMmGWks1DawE1yc4UlOI6pbH3XVxdVArj9lLOyD18="
		},
		"publicKey": {
			"$id": "#/definitions/publicKey",
			"type": "string",
			"title": "WireGuard public key",
			"pattern": "^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw480]=$",
			"example": "2OGuuIWQLKvtVYGntdHSoRb8MtDyKq6wxKd9vQphzDQ="
		},
		"psk": {
			"$id": "#/definitions/psk",
			"title": "WireGuard pre-shared key",
			"example": "Tkyhh13wpqw/ffriFSQtR8TNdxyT9s2MPhqLlT5Z2SA=",
			"oneOf": [
				{

					"type": "string",
					"pattern": "^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw480]=$"
				},
				{
					"type": "null"
				}
			]
		},
		"name": {
			"$id": "#/definitions/name",
			"title": "WireGuard tunnel name",
			"type": "string",
			"description": "WireGuard interface name",
			"example": "wg0"
		},
		"peers": {
			"$id": "#/definitions/peers",
			"title": "WireGuard tunnel peers",
			"type": "array",
			"additionalItems": false,
			"items": {
				"$id": "#/properties/peers/items",
				"title": "WireGuard tunnel peer object",
				"type": "object",
				"required": [
					"publicKey",
					"persistentKeepalive",
					"endpoint",
					"port",
					"allowedIps"
				],
				"additionalProperties": false,
				"properties": {
					"publicKey": {
						"$id": "#/properties/peers/items/properties/publicKey",
						"$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/schemas/definitions/wireGuard.json#/definitions/publicKey"
					},
					"psk": {
						"$id": "#/properties/peers/items/properties/psk",
						"$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/schemas/definitions/wireGuard.json#/definitions/psk"
					},
					"persistentKeepalive": {
						"$id": "#/properties/peers/items/properties/persistentKeepalive",
						"title": "WireGuard tunnel peer keepalive interval",
						"type": "integer",
						"minimum": 0,
						"example": 25
					},
					"endpoint": {
						"$id": "#/properties/peers/items/properties/endpoint",
						"title": "WireGuard tunnel peer endpoint",
						"type": "object",
						"additionalProperties": false,
						"required": [
							"address",
							"port"
						],
						"properties": {
							"address": {
								"$id": "#/properties/peers/items/properties/endpoint/properties/address",
								"title": "WireGuard tunnel peer endpoint address",
								"type": "string",
								"format": "hostname"
							},
							"port": {
								"$id": "#/properties/peers/items/properties/endpoint/properties/port",
								"title": "WireGuard tunnel peer endpoint port",
								"type": "integer",
								"minimum": 0,
								"maximum": 65535
							}
						},
						"example": {
							"address": "vpn.example.org",
							"port": 51820
						}
					},
					"port": {
						"$id": "#/properties/peers/items/properties/port",
						"$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/schemas/definitions/wireGuard.json#/definitions/port"
					},
					"allowedIps": {
						"$id": "#/properties/peers/items/properties/allowedIps",
						"title": "WireGuard tunnel peer allowed IP addresses",
						"type": "array",
						"additionalItems": false,
						"items": {
							"$id": "#/properties/peers/items/properties/allowedIps/items",
							"oneOf": [
								{
									"$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/schemas/definitions/wireGuard.json#/definitions/ipv4"
								},
								{
									"$ref": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/schemas/definitions/wireGuard.json#/definitions/ipv6"
								}
							]
						}
					}
				}
			}
		},
		"port": {
			"$id": "#/definitions/port",
			"title": "WireGuard tunnel listen port",
			"type": "integer",
			"minimum": 0,
			"maximum": 65535,
			"example": 58775
		},
		"mtu": {
			"$id": "#/definitions/mtu",
			"title": "WireGuard interface MTU",
			"type": "integer",
			"minimum": 1,
			"maximum": 65535,
			"default": 1420,
			"example": 1420
		}
	}
}
