{
	"$schema": "http://json-schema.org/draft-04/schema",
	"$id": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/schemas/controllerConfig.json",
	"type": "object",
	"title": "IQRF Gateway Controller configuration",
	"description": "Schema of the Controller configuration file.",
	"examples": [
		{
			"daemonApi": {
				"autoNetwork": {
					"actionRetries": 1,
					"discoveryBeforeStart": true,
					"discoveryTxPower": 6,
					"skipDiscoveryEachWave": false,
					"stopConditions": {
						"abortOnTooManyNodesFound": false,
						"emptyWaves": 2,
						"waves": 2
					},
					"returnVerbose": false
				},
				"discovery": {
					"maxAddr": 0,
					"txPower": 6,
					"returnVerbose": false
				}
			},
			"factoryReset": {
				"coordinator": false,
				"daemon": true,
				"network": false,
				"webapp": false
			},
			"logger": {
				"filePath": "/var/log/iqrf-gateway-controller.log",
				"severity": "info",
				"sinks": {
					"file": true,
					"syslog": false
				}
			},
			"powerOff": {
				"sda": -1,
				"sck": -1
			},
			"resetButton": {
				"api": "autoNetwork",
				"button": 2
			},
			"statusLed": {
				"greenLed": 0,
				"redLed": 1
			},
			"wsServers": {
				"api": "ws://localhost:1338",
				"monitor": "ws://localhost:1438",
				"token": "iqrfgd2;1;ETi3v8RGLVGXb/uNenhskEiSH/2KussEbantcvjfGQ4="
			}
		}
	],
	"required": [
		"daemonApi",
		"factoryReset",
		"logger",
		"powerOff",
		"resetButton",
		"statusLed",
		"wsServers"
	],
	"additionalProperties": false,
	"properties": {
		"daemonApi": {
			"$id": "#/properties/daemonApi",
			"type": "object",
			"title": "Daemon API configuration",
			"description": "Configuration of Daemon API calls executed by controller.",
			"examples": [
				{
					"autoNetwork": {
						"actionRetries": 1,
						"discoveryBeforeStart": true,
						"discoveryTxPower": 6,
						"skipDiscoveryEachWave": false,
						"stopConditions": {
							"abortOnTooManyNodesFound": false,
							"emptyWaves": 2,
							"waves": 2
						},
						"returnVerbose": false
					},
					"discovery": {
						"maxAddr": 0,
						"txPower": 6,
						"returnVerbose": false
					}
				}
			],
			"required": [
				"autoNetwork",
				"discovery"
			],
			"properties": {
				"autoNetwork": {
					"$id": "#/properties/daemonApi/properties/autoNetwork",
					"type": "object",
					"title": "AutoNetwork",
					"description": "Configuration of the AutoNetwork Daemon API call.",
					"examples": [
						{
							"actionRetries": 1,
							"discoveryBeforeStart": true,
							"discoveryTxPower": 6,
							"skipDiscoveryEachWave": false,
							"stopConditions": {
								"abortOnTooManyNodesFound": false,
								"emptyWaves": 2,
								"waves": 2
							},
							"returnVerbose": false
						}
					],
					"required": [
						"actionRetries",
						"discoveryBeforeStart",
						"discoveryTxPower",
						"skipDiscoveryEachWave",
						"stopConditions",
						"returnVerbose"
					],
					"properties": {
						"actionRetries": {
							"$id": "#/properties/daemonApi/properties/autoNetwork/properties/actionRetries",
							"type": "integer",
							"title": "Number of retry DPA transactions",
							"minimum": 0,
							"maximum": 3,
							"default": 1,
							"example": 1
						},
						"discoveryBeforeStart": {
							"$id": "#/properties/daemonApi/properties/autoNetwork/properties/discoveryBeforeStart",
							"type": "boolean",
							"title": "Run Discovery before the AutoNetwork process begins",
							"default": true,
							"example": true
						},
						"discoveryTxPower": {
							"$id": "#/properties/daemonApi/properties/autoNetwork/properties/discoveryTxPower",
							"type": "integer",
							"title": "TX power",
							"minimum": 0,
							"maximum": 7,
							"default": 6,
							"example": 6
						},
						"skipDiscoveryEachWave": {
							"$id": "#/properties/daemonApi/properties/autoNetwork/properties/skipDiscoveryEachWave",
							"type": "boolean",
							"title": "Skip Discovery in each wave",
							"default": false,
							"example": false
						},
						"stopConditions": {
							"$id": "#/properties/daemonApi/properties/autoNetwork/properties/stopConditions",
							"type": "object",
							"title": "AutoNetwork process stop conditions",
							"examples": [
								{
									"abortOnTooManyNodesFound": false,
									"emptyWaves": 2,
									"waves": 2
								}
							],
							"required": [
								"abortOnTooManyNodesFound",
								"emptyWaves",
								"waves"
							],
							"properties": {
								"abortOnTooManyNodesFound": {
									"$id": "#/properties/daemonApi/properties/autoNetwork/properties/stopConditions/properties/abortOnTooManyNodesFound",
									"type": "boolean",
									"title": "Abort Autonetwork if too many nodes were found",
									"default": false,
									"example": false
								},
								"emptyWaves": {
									"$id": "#/properties/daemonApi/properties/autoNetwork/properties/stopConditions/properties/emptyWaves",
									"type": "integer",
									"title": "Empty waves",
									"description": "Number of consecutive AutoNetwork waves with no new nodes found.",
									"minimum": 1,
									"maximum": 127,
									"default": 2,
									"example": 2
								},
								"waves": {
									"$id": "#/properties/daemonApi/properties/autoNetwork/properties/stopConditions/properties/waves",
									"type": "integer",
									"title": "Waves",
									"description": "Maximum number of AutoNetwork waves.",
									"minimum": 1,
									"maximum": 127,
									"default": 2,
									"example": 2
								}
							},
							"additionalProperties": false
						},
						"returnVerbose": {
							"$id": "#/properties/daemonApi/properties/autoNetwork/properties/returnVerbose",
							"type": "boolean",
							"title": "Verbose mode",
							"default": false,
							"example": false
						}
					},
					"additionalProperties": false
				},
				"discovery": {
					"$id": "#/properties/daemonApi/properties/discovery",
					"type": "object",
					"title": "Discovery",
					"description": "Configuration of the Discovery Daemon API call.",
					"examples": [
						{
							"maxAddr": 0,
							"txPower": 6,
							"returnVerbose": false
						}
					],
					"required": [
						"maxAddr",
						"txPower",
						"returnVerbose"
					],
					"properties": {
						"maxAddr": {
							"$id": "#/properties/daemonApi/properties/discovery/properties/maxAddr",
							"type": "integer",
							"title": "Maximum address",
							"minimum": 0,
							"maximum": 239,
							"default": 0,
							"example": 0
						},
						"txPower": {
							"$id": "#/properties/daemonApi/properties/discovery/properties/txPower",
							"type": "integer",
							"title": "TX power",
							"minimum": 0,
							"maximum": 7,
							"default": 6,
							"example": 6
						},
						"returnVerbose": {
							"$id": "#/properties/daemonApi/properties/discovery/properties/returnVerbose",
							"type": "boolean",
							"title": "Verbose mode",
							"default": false,
							"example": false
						}
					},
					"additionalProperties": false
				}
			},
			"additionalProperties": false
		},
		"factoryReset": {
			"$id": "#/properties/factoryReset",
			"type": "object",
			"title": "Factory reset",
			"description": "Configuration of the Factory reset action.",
			"examples": [
				{
					"coordinator": false,
					"daemon": true,
					"network": false,
					"webapp": false
				}
			],
			"required": [
				"coordinator",
				"daemon",
				"network",
				"webapp"
			],
			"properties": {
				"coordinator": {
					"$id": "#/properties/factoryReset/properties/coordinator",
					"type": "boolean",
					"title": "Reset Coordinator",
					"default": false,
					"example": false
				},
				"daemon": {
					"$id": "#/properties/factoryReset/properties/daemon",
					"type": "boolean",
					"title": "Daemon",
					"default": true,
					"example": true
				},
				"iqaros": {
					"$id": "#/properties/factoryReset/properties/iqaros",
					"type": "boolean",
					"title": "Reset IQAROS",
					"default": false,
					"example": false
				},
				"network": {
					"$id": "#/properties/factoryReset/properties/network",
					"type": "boolean",
					"title": "Reset network",
					"default": false,
					"example": false
				},
				"webapp": {
					"$id": "#/properties/factoryReset/properties/webapp",
					"type": "boolean",
					"title": "Reset webapp",
					"default": false,
					"example": false
				}
			},
			"additionalProperties": false
		},
		"logger": {
			"$id": "#/properties/logger",
			"type": "object",
			"title": "Logger configuration",
			"examples": [
				{
					"filePath": "/var/log/iqrf-gateway-controller.log",
					"severity": "info",
					"sinks": {
						"file": true,
						"syslog": false
					}
				}
			],
			"required": [
				"filePath",
				"severity",
				"sinks"
			],
			"properties": {
				"filePath": {
					"$id": "#/properties/logger/properties/filePath",
					"type": "string",
					"title": "Path to log file.",
					"default": "/var/log/iqrf-gateway-controller.log",
					"examples": [
						"/var/log/iqrf-gateway-controller.log"
					]
				},
				"severity": {
					"$id": "#/properties/logger/properties/severity",
					"type": "string",
					"title": "Severity",
					"description": "Specifies the level of logged information.",
					"default": "info",
					"examples": [
						"info",
						"error"
					]
				},
				"sinks": {
					"$id": "#/properties/logger/properties/sinks",
					"type": "object",
					"title": "Logger sinks",
					"required": [
						"file",
						"syslog"
					],
					"additionalProperties": false,
					"properties": {
						"file": {
							"$id": "#/properties/logger/properties/sinks/properties/file",
							"type": "boolean",
							"title": "Log to file",
							"example": true
						},
						"syslog": {
							"$id": "#/properties/logger/properties/sinks/properties/syslog",
							"type": "boolean",
							"title": "Log to syslog",
							"example": false
						}
					}
				}
			},
			"additionalProperties": false
		},
		"powerOff": {
			"$id": "#/properties/powerOff",
			"type": "object",
			"title": "Power off pin configuration",
			"examples": [
				{
					"sda": 12,
					"sck": 12
				}
			],
			"required": [
				"sda",
				"sck"
			],
			"properties": {
				"sda": {
					"$id": "#/properties/powerOff/properties/sda",
					"type": "integer",
					"title": "Data pin",
					"description": "I2C data line pin.",
					"example": 12
				},
				"sck": {
					"$id": "#/properties/powerOff/properties/sck",
					"type": "integer",
					"title": "Clock pin",
					"description": "I2C clock line pin.",
					"example": 11
				}
			}
		},
		"resetButton": {
			"$id": "#/properties/resetButton",
			"type": "object",
			"title": "Reset button configuration",
			"examples": [
				{
					"api": "autoNetwork",
					"button": 2
				}
			],
			"required": [
				"api",
				"button"
			],
			"properties": {
				"api": {
					"$id": "#/properties/resetButton/properties/api",
					"type": "string",
					"title": "API call",
					"description": "Daemon API call to be executed by the controller.",
					"default": "autoNetwork",
					"examples": [
						"autoNetwork",
						"discovery"
					]
				},
				"button": {
					"$id": "#/properties/resetButton/properties/button",
					"type": "integer",
					"title": "Button pin",
					"default": 2,
					"example": 2
				}
			},
			"additionalProperties": false
		},
		"statusLed": {
			"$id": "#/properties/statusLed",
			"type": "object",
			"title": "Status LED configuration",
			"examples": [
				{
					"greenLed": 0,
					"redLed": 1
				}
			],
			"required":[
				"greenLed",
				"redLed"
			],
			"properties": {
				"greenLed": {
					"$id": "#/properties/statusLed/properties/greenLed",
					"type": "integer",
					"title": "Green LED pin",
					"default": 0,
					"example": 0
				},
				"redLed": {
					"$id": "#/properties/statusLed/properties/redLed",
					"type": "integer",
					"title": "Red LED pin",
					"default": 1,
					"example": 1
				}
			},
			"additionalProperties": false
		},
		"wsServers": {
			"$id": "#/properties/wsServers",
			"type": "object",
			"title": "Websocket servers",
			"description": "Addresses and ports for websocket connections.",
			"examples": [
				{
					"api": "ws://localhost:1338",
					"monitor": "ws://localhost:1438"
				}
			],
			"required": [
				"api",
				"monitor",
				"token"
			],
			"additionalProperties": false,
			"properties": {
				"api": {
					"$id": "#/properties/wsServers/properties/api",
					"type": "string",
					"title": "websocket API",
					"description": "API websocket connection address and port.",
					"example": "ws://localhost:1338"
				},
				"monitor": {
					"$id": "#/properties/wsServers/properties/monitor",
					"type": "string",
					"title": "The monitor schema",
					"description": "Monitor websocket connection address and port.",
					"example": "ws://localhost:1438"
				},
				"token": {
					"$id": "#/properties/wsServers/properties/token",
					"type": "string",
					"title": "Access token",
					"description": "Daemon WebSocket API access token.",
					"example": "iqrfgd2;1;ETi3v8RGLVGXb/uNenhskEiSH/2KussEbantcvjfGQ4="
				}
			}
		}
	}
}
