{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "description": "The ratectl settings",
    "additionalProperties": false,
    "required": [
        "version"
    ],
    "properties": {
        "version": {
            "type": "string",
            "enum": [
                "6.5"
            ],
            "description": "The software version the configuration was created for"
        },
        "environment": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "controlsocket": {
                    "oneOf": [
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                                "path": {
                                    "type": "string",
                                    "default": "/var/run/halon/rated.ctl",
                                    "description": "Control socket path to rated process"
                                }
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                                "port"
                            ],
                            "properties": {
                                "port": {
                                    "type": "integer",
                                    "maximum": 65535,
                                    "minimum": 1,
                                    "description": "Port number"
                                },
                                "address": {
                                    "description": "IP address",
                                    "anyOf": [
                                        {
                                            "$ref": "#/definitions/ipv4"
                                        },
                                        {
                                            "$ref": "#/definitions/ipv6"
                                        }
                                    ]
                                }
                            }
                        }
                    ]
                }
            }
        }
    },
    "definitions": {
        "ipv4": {
            "type": "string",
            "pattern": "^(?!(?:\/.*\/|#.*|.*[*].*)$)(?:(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(\\.(?!$)|$)){4}$",
            "minLength": 7
        },
        "ipv6": {
            "type": "string",
            "pattern": "^(?!(?:\/.*\/|#.*|.*[*].*)$)(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$",
            "minLength": 3
        }
    }
}