{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "definitions": {
        "program": {
            "description": "Defines an auxiliary programs to be launched at system startup.",
            "type": "object",
            "properties": {
                "autostart": {
                    "type": "boolean",
                    "description": "If true, then the Engine will attempt to start this process at system startup."
                },
                "dir": {
                    "type": "string",
                    "description": "Full path to the program or script file."
                },
                "cmd": {
                    "type": "string",
                    "description": "The program or script to run."
                },
                "args": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "description": "An array of strings, with each flag and setting as a separate string."
                }
            },
            "required": [
                "autostart",
                "dir",
                "cmd",
                "args"
            ]
        },
        "adapter": {
            "description": "Defines one Adapter the Engine will use.",
            "type": "object",
            "properties": {
                "type": {
                    "description": "Adapter type, e.g. CitySourced, Email, SCF",
                    "type": "string"
                },
                "address": {
                    "description": "IP address and port number for the RPC connection of the Adapter.  This is specified in the Adapter's config file.",
                    "type": "string"
                },
                "startup": {
                    "description": "The startup parameters for the Adapter.",
                    "type": "object",
                    "properties": {
                        "autostart": {
                            "description": "If true, then the Engine will attempt to start this process at system startup.",
                            "type": "boolean"
                        },
                        "dir": {
                            "description": "Full path to the program or script file.",
                            "type": "string"
                        },
                        "cmd": {
                            "description": "The program or script to run.",
                            "type": "string"
                        },
                        "args": {
                            "description": "An array of strings, with each flag and setting as a separate string.",
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    },
                    "required": [
                        "autostart",
                        "dir",
                        "cmd",
                        "args"
                    ]
                }
            },
            "required": [
                "type",
                "address",
                "startup"
            ]
        },
        "area": {
            "description": "This is a map of all the Areas serviced by this Gateway instance.",
            "type": "object",
            "properties": {
                "name": {
                    "description": "Name of the Area.",
                    "type": "string"
                },
                "aliases": {
                    "description": "A list of aliases for the Area.  For example, an alias of 'San Jose' might be 'SJ'.",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "name"
            ]
        }
    },
    "properties": {
        "network": {
            "description": "Network settings for the Server.",
            "type": "object",
            "properties": {
                "address": {
                    "description": "IP (optional) and port number the server will be running on.  NOTE: HTTPS is currently not supported.",
                    "type": "string"
                },
                "protocol": {
                    "description": "HTTP or HTTPS.  Currently only HTTP is supported... setting this flag to HTTPS will have no effect.",
                    "type": "string",
                    "enum": [
                        "http",
                        "HTTP",
                        "https",
                        "HTTPS"
                    ]
                },
                "certFile": {
                    "description": "The path and filename of the HTTPS certificate file.",
                    "type": "string"
                },
                "keyFile": {
                    "description": "The path and filename of the private key file for the server.",
                    "type": "string"
                }
            },
            "required": [
                "address"
            ]
        },
        "auxiliary": {
            "description": "The list of all auxiliary programs to be launched at system startup.",
            "type": "array",
            "items": {
                "allOf": [
                    {
                        "properties": {
                            "name": {
                                "description": "The *unique* name of the program.  This identifies the auxiliary program in error messages and logs.",
                                "type": "string"
                            }
                        }
                    },
                    {
                        "$ref": "#/definitions/program"
                    }
                ]
            }
        },
        "monitor": {
            "description": "Configuration data for the System Monitor.",
            "type": "object",
            "properties": {
                "address": {
                    "description": "IP and port of the system monitor.",
                    "type:": "string"
                }
            },
            "required": [
                "address"
            ]
        },
        "general": {
            "description": "General configuration parameters.",
            "type": "object",
            "properties": {
                "searchRadiusMin": {
                    "description": "Minimum search radius.  Anything lower will be set to this.",
                    "type:": "number"
                },
                "searchRadiusMax": {
                    "description": "Maximum search radius.  Anything higher will be set to this.",
                    "type:": "number"
                }
            },
            "required": [
                "searchRadiusMin",
                "searchRadiusMax"
            ]
        },
        "adapters": {
            "description": "The list of all Adapters the Engine should attempt to connect to.",
            "additionalProperties": {
                "$ref": "#/definitions/adapter"
            }
        },
        "areas": {
            "description": "The list of all geographic areas the Engine will service.",
            "additionalProperties": {
                "$ref": "#/definitions/area"
            }
        }
    }
}