{
    "$schema"               : "http://json-schema.org/draft-04/schema#",
    "id"                    : "https://eddn.edcd.io/schemas/navroute/1#",
    "type"                  : "object",
    "additionalProperties"  : false,
    "required": [ "$schemaRef", "header", "message" ],
    "properties": {
        "$schemaRef": {
            "type"                  : "string"
        },
        "header": {
            "type"                  : "object",
            "additionalProperties"  : true,
            "required"              : [ "uploaderID", "softwareName", "softwareVersion" ],
            "properties"            : {
                "uploaderID": {
                    "type"          : "string"
                },
                "gameversion": {
                    "type"          : "string",
                    "description"   : "From Fileheader event if available, else LoadGame if available there."
                },
                "gamebuild": {
                    "type"          : "string",
                    "description"   : "The `build` value from a Fileheader event if available, else LoadGame if available there."
                },
                "softwareName": {
                    "type"          : "string"
                },
                "softwareVersion": {
                    "type"          : "string"
                },
                "gatewayTimestamp": {
                    "type"          : "string",
                    "format"        : "date-time",
                    "description"   : "Timestamp upon receipt at the gateway. If present, this property will be overwritten by the gateway; submitters are not intended to populate this property."
                }
            }
        },
        "message": {
            "type"                  : "object",
            "additionalProperties"  : false,
            "required"              : [ "timestamp", "event", "Route" ],
            "properties"            : {
                "timestamp": {
                    "type"          : "string",
                    "format"        : "date-time"
                },
                "event": {
                    "enum"      : [ "NavRoute" ]
                },
                "horizons": {
                    "type"      : "boolean",
                    "description" : "Whether the sending Cmdr has a Horizons pass."
                },
                "odyssey": {
                    "type"      : "boolean",
                    "description" : "Whether the sending Cmdr has an Odyssey expansion."
                },
                "Route": {
                    "type"      : "array",
                    "description" : "Route generated by in game plotter",
                    "items"     : {
                        "type"                  : "object",
                        "additionalProperties"  : false,
                        "required"              : [ "StarSystem", "SystemAddress", "StarPos", "StarClass" ],
                        "properties"            : {
                            "StarSystem": {
                                "type"          : "string",
                                "minLength"     : 1
                            },
                            "StarPos": {
                                "type"          : "array",
                                "items"         : { "type": "number" },
                                "minItems"      : 3,
                                "maxItems"      : 3
                            },
                            "SystemAddress": {
                                "type"          : "integer"
                            },
                            "StarClass": {
                                "type"          : "string",
                                "minLength"     : 1
                            }
                        }
                    }
                }
            }
        }
    }
}
