{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/IoBJson",
  "definitions": {
    "IoBJson": {
      "type": "object",
      "properties": {
        "system": {
          "type": "object",
          "properties": {
            "memoryLimitMB": {
              "type": "number",
              "description": "do not use more than memory limit mb by ioB process (0 to deactivate)"
            },
            "hostname": {
              "type": "string",
              "description": "if empty, determine use real hostname"
            },
            "statisticsInterval": {
              "type": "number",
              "description": "Interval how often the counters for input/output in adapters and controller will be updated in ms"
            },
            "// statisticsInterval": {
              "type": "string"
            },
            "checkDiskInterval": {
              "type": "number",
              "description": "Interval how often the disk size will be checked in ms"
            },
            "// checkDiskInterval": {
              "type": "string"
            },
            "instanceStartInterval": {
              "type": "number",
              "description": "interval to wait between multiple instances starts"
            },
            "compact": {
              "type": "boolean",
              "description": "Controller will try to start the instances as a part of the same process. No spawn will be done. Only by adapters that support it and have flag compact flag in io-package.json"
            },
            "// compact": {
              "type": "string"
            },
            "allowShellCommands": {
              "type": "boolean",
              "description": "Allow execution of \"shell\" sendToHost commands"
            },
            "// allowShellCommands": {
              "type": "string"
            },
            "memLimitWarn": {
              "type": "number",
              "description": "If the available RAM is below this threshold on adapter start, a warning will be logged."
            },
            "// memLimitWarn": {
              "type": "string"
            },
            "memLimitError": {
              "type": "number",
              "description": "If the available RAM is below this threshold on adapter start, an error will be logged."
            },
            "// memLimitError": {
              "type": "string"
            }
          },
          "required": [
            "memoryLimitMB",
            "hostname",
            "statisticsInterval",
            "// statisticsInterval",
            "checkDiskInterval",
            "// checkDiskInterval",
            "instanceStartInterval",
            "compact",
            "// compact",
            "allowShellCommands",
            "// allowShellCommands",
            "memLimitWarn",
            "// memLimitWarn",
            "memLimitError",
            "// memLimitError"
          ],
          "additionalProperties": false
        },
        "multihostService": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "secure": {
              "type": "boolean"
            },
            "password": {
              "type": "string"
            }
          },
          "required": [
            "enabled",
            "secure",
            "password"
          ],
          "additionalProperties": false
        },
        "objects": {
          "$ref": "#/definitions/ObjectsDatabaseOptions"
        },
        "states": {
          "$ref": "#/definitions/DatabaseOptions"
        },
        "log": {
          "type": "object",
          "properties": {
            "level": {
              "type": "string"
            },
            "maxDays": {
              "type": "number"
            },
            "noStdout": {
              "type": "boolean"
            },
            "transport": {
              "type": "object"
            }
          },
          "required": [
            "level",
            "maxDays",
            "noStdout",
            "transport"
          ],
          "additionalProperties": false
        },
        "dataDir": {
          "type": "string",
          "description": "Always relative to iobroker.js-controller/"
        },
        "// dataDir": {
          "type": "string"
        },
        "plugins": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              }
            },
            "required": [
              "enabled"
            ],
            "additionalProperties": {}
          }
        },
        "// dnsResolution": {
          "type": "string"
        },
        "dnsResolution": {
          "type": "string",
          "enum": [
            "verbatim",
            "ipv4first"
          ],
          "description": "Use 'verbatim' for ipv6 first, else use 'ipv4first'"
        }
      },
      "required": [
        "system",
        "multihostService",
        "objects",
        "states",
        "log",
        "dataDir",
        "// dataDir",
        "plugins",
        "// dnsResolution",
        "dnsResolution"
      ],
      "additionalProperties": false,
      "description": "The ioBroker global config"
    },
    "ObjectsDatabaseOptions": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "jsonl",
            "file",
            "redis"
          ],
          "description": "Possible values: 'file' - [port 9001], 'jsonl' - [port 9001], 'redis' - [port 6379 or 26379 for sentinel]."
        },
        "// type": {
          "type": "string"
        },
        "host": {
          "type": "string"
        },
        "port": {
          "type": "number"
        },
        "connectTimeout": {
          "type": "number"
        },
        "writeFileInterval": {
          "type": "number"
        },
        "dataDir": {
          "type": "string"
        },
        "options": {
          "type": "object",
          "properties": {
            "auth_pass": {
              "type": "string"
            },
            "retry_max_delay": {
              "type": "number"
            },
            "retry_max_count": {
              "type": "number"
            },
            "db": {
              "type": "number"
            },
            "family": {
              "type": "number"
            }
          },
          "required": [
            "auth_pass",
            "retry_max_delay",
            "retry_max_count",
            "db",
            "family"
          ],
          "additionalProperties": false
        },
        "backup": {
          "$ref": "#/definitions/DatabaseBackupOptions"
        },
        "jsonlOptions": {
          "$ref": "#/definitions/JsonlOptions"
        },
        "noFileCache": {
          "type": "boolean"
        },
        "maxQueue": {
          "type": "number"
        }
      },
      "required": [
        "// type",
        "backup",
        "connectTimeout",
        "dataDir",
        "host",
        "jsonlOptions",
        "maxQueue",
        "noFileCache",
        "options",
        "port",
        "type",
        "writeFileInterval"
      ],
      "additionalProperties": false
    },
    "DatabaseBackupOptions": {
      "type": "object",
      "properties": {
        "disabled": {
          "type": "boolean"
        },
        "files": {
          "type": "number",
          "description": "Minimal number of backup files, after the deletion will be executed according to backupTime settings"
        },
        "// files": {
          "type": "string"
        },
        "hours": {
          "type": "number",
          "description": "All backups older than configured hours will be deleted. But only if the number of files is greater than of backupNumber"
        },
        "// hours": {
          "type": "string"
        },
        "period": {
          "type": "number",
          "description": "by default backup every 2 hours. Time is in minutes. To disable backup set the value to 0"
        },
        "// period": {
          "type": "string"
        },
        "path": {
          "type": "string",
          "description": "Absolute path to backup directory or empty to backup in data directory"
        },
        "// path": {
          "type": "string"
        }
      },
      "required": [
        "disabled",
        "files",
        "// files",
        "hours",
        "// hours",
        "period",
        "// period",
        "path",
        "// path"
      ],
      "additionalProperties": false
    },
    "JsonlOptions": {
      "type": "object",
      "properties": {
        "// autoCompress (1)": {
          "type": "string"
        },
        "// autoCompress (2)": {
          "type": "string"
        },
        "// autoCompress (3)": {
          "type": "string"
        },
        "autoCompress": {
          "type": "object",
          "properties": {
            "sizeFactor": {
              "type": "number"
            },
            "sizeFactorMinimumSize": {
              "type": "number"
            }
          },
          "required": [
            "sizeFactor",
            "sizeFactorMinimumSize"
          ],
          "additionalProperties": false,
          "description": "The JSONL DB is append-only and will contain unnecessary entries after a while. It will be compressed when the uncompressed size is >= size * sizeFactor AND >= sizeFactorMinimumSize Note that too low values here will cause the DB to be rewritten often."
        },
        "// ignoreReadErrors": {
          "type": "string"
        },
        "ignoreReadErrors": {
          "type": "boolean",
          "const": true,
          "description": "If single lines in the DB are corrupted, they can be ignored without losing the whole DB."
        },
        "// throttleFS (1)": {
          "type": "string"
        },
        "// throttleFS (2)": {
          "type": "string"
        },
        "throttleFS": {
          "type": "object",
          "properties": {
            "// intervalMs": {
              "type": "string"
            },
            "intervalMs": {
              "type": "number",
              "description": "Write to the database file no more than every intervalMs milliseconds."
            },
            "// maxBufferedCommands": {
              "type": "string"
            },
            "maxBufferedCommands": {
              "type": "number",
              "description": "Force writing after this many changes have been buffered. This reduces memory consumption and data loss in case of a crash."
            }
          },
          "required": [
            "// intervalMs",
            "intervalMs",
            "// maxBufferedCommands",
            "maxBufferedCommands"
          ],
          "additionalProperties": false,
          "description": "By default, the database immediately writes to the database file. Write accesses can be reduced using the throttleFS option. Be aware that buffered changes will be lost in case the process crashes"
        }
      },
      "required": [
        "// autoCompress (1)",
        "// autoCompress (2)",
        "// autoCompress (3)",
        "autoCompress",
        "// ignoreReadErrors",
        "ignoreReadErrors",
        "// throttleFS (1)",
        "// throttleFS (2)",
        "throttleFS"
      ],
      "additionalProperties": false
    },
    "DatabaseOptions": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "jsonl",
            "file",
            "redis"
          ],
          "description": "Possible values: 'file' - [port 9001], 'jsonl' - [port 9001], 'redis' - [port 6379 or 26379 for sentinel]."
        },
        "// type": {
          "type": "string"
        },
        "host": {
          "type": "string"
        },
        "port": {
          "type": "number"
        },
        "connectTimeout": {
          "type": "number"
        },
        "writeFileInterval": {
          "type": "number"
        },
        "dataDir": {
          "type": "string"
        },
        "options": {
          "type": "object",
          "properties": {
            "auth_pass": {
              "type": "string"
            },
            "retry_max_delay": {
              "type": "number"
            },
            "retry_max_count": {
              "type": "number"
            },
            "db": {
              "type": "number"
            },
            "family": {
              "type": "number"
            }
          },
          "required": [
            "auth_pass",
            "retry_max_delay",
            "retry_max_count",
            "db",
            "family"
          ],
          "additionalProperties": false
        },
        "backup": {
          "$ref": "#/definitions/DatabaseBackupOptions"
        },
        "jsonlOptions": {
          "$ref": "#/definitions/JsonlOptions"
        }
      },
      "required": [
        "type",
        "// type",
        "host",
        "port",
        "connectTimeout",
        "writeFileInterval",
        "dataDir",
        "options",
        "backup",
        "jsonlOptions"
      ],
      "additionalProperties": false
    }
  }
}