{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://apidocs.iqrf.org/openapi/iqrf-gateway-webapp/v2.7.0-rc3/schemas/bridgeConfig.json",
    "title": "Configuration schema",
    "description": "IQRF Gateway InfluxDB Bridge configuration schema.",
    "type": "object",
    "examples": [
        {
            "influx": {
                "url": "http://127.0.0.1:8086",
                "org": "org",
                "user": "user",
                "password": "password",
                "token": "exampletoken",
                "buckets": {
                    "gateway": "gateway",
                    "devices": "devices",
                    "sensors": "sensors"
                }
            },
            "mqtt": {
                "host": "localhost",
                "port": 1883,
                "user": "user",
                "password": "password",
                "client": "client",
                "topics": [
                    "exampletopic"
                ],
                "trustStore": ""
            },
            "logLevel": "INFO"
        }
    ],
    "required": [
        "influx",
        "mqtt",
        "logLevel"
    ],
    "additionalProperties": false,
    "properties": {
        "influx": {
            "title": "InfluxDB",
            "description": "InfluxDB client configuration.",
            "type": "object",
            "required": [
                "url",
                "user",
                "password",
                "token",
                "buckets",
                "org"
            ],
            "additionalProperties": false,
            "properties": {
                "url": {
                    "title": "URL",
                    "description": "InfluxDB server URL.",
                    "type": "string",
                    "minLength": 1
                },
                "user": {
                    "title": "User",
                    "description": "InfluxDB API authentication username (1.x).",
                    "type": "string"
                },
                "password": {
                    "title": "Password",
                    "description": "InfluxDB API authentication password (1.x)."
                },
                "token": {
                    "title": "API token",
                    "description": "InfluxDB API authentication token (2.0).",
                    "type": "string"
                },
                "org": {
                    "title": "Organization",
                    "description": "InfluxDB organization name.",
                    "type": "string"
                },
                "buckets": {
                    "title": "Buckets",
                    "description": "InfluxDB buckets.",
                    "type": "object",
                    "required": [
                        "gateway",
                        "devices",
                        "sensors"
                    ],
                    "additionalProperties": false,
                    "properties": {
                        "gateway": {
                            "title": "Gateway bucket",
                            "description": "Bucket for gateway data.",
                            "type": "string"
                        },
                        "devices": {
                            "title": "Device bucket",
                            "description": "Bucket for device data.",
                            "type": "string"
                        },
                        "sensors": {
                            "title": "Sensor bucket",
                            "description": "Bucket for sensor data.",
                            "type": "string"
                        }
                    }
                }
            }
        },
        "mqtt": {
            "title": "MQTT",
            "description": "MQTT client configuration.",
            "type": "object",
            "required": [
                "host",
                "port",
                "user",
                "password",
                "topics",
                "trustStore"
            ],
            "additionalProperties": false,
            "properties": {
                "host": {
                    "title": "Host",
                    "description": "MQTT broker hostname.",
                    "type": "string"
                },
                "port": {
                    "title": "Port",
                    "description": "MQTT broker port.",
                    "type": "integer"
                },
                "user": {
                    "title": "User",
                    "description": "MQTT broker access username.",
                    "type": "string"
                },
                "password": {
                    "title": "Password",
                    "description": "MQTT broker access password.",
                    "type": "string"
                },
                "client": {
                    "title": "Client ID",
                    "description": "MQTT client ID.",
                    "type": "string"
                },
                "topics": {
                    "title": "Response topics",
                    "description": "Array of topics to subscribe to.",
                    "type": "array",
                    "uniqueItems": true,
                    "items": {
                        "title": "Response topic",
                        "description": "Response topic to subscribe to.",
                        "type": "string"
                    }
                },
                "trustStore": {
                    "title": "Broker CA",
                    "description": "Path to server CA file.",
                    "type": "string"
                }
            }
        },
        "logLevel": {
            "title": "Logging severity",
            "description": "Logging threshold.",
            "type": "string",
            "enum": [
                "CRITICAL",
                "FATAL",
                "ERROR",
                "WARNING",
                "INFO",
                "DEBUG"
            ]
        }
    }
}
