diff --git a/schemas/api/trains/TrainDetails.json b/schemas/api/trains/TrainDetails.json new file mode 100644 index 0000000..306ee22 --- /dev/null +++ b/schemas/api/trains/TrainDetails.json @@ -0,0 +1,215 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema#", + "title": "TrainByHeadcodeResponse", + "$defs": { + "DateTimeTZ": { + "type": "string", + "format": "date-time", + "description": "An ISO-8601 timestamp" + }, + "ServiceLocation": { + "type": "object", + "description": "A specific location along the services journey", + "additionalProperties": false, + "properties": { + "t": { + "type": "string", + "title": "TIPLOC", + "description": "The TIPLOC of the location" + }, + "r": { + "type": "string", + "enum": ["ORIG", "CALL", "PASS", "DEST"], + "title": "Location Role", + "description": "The role of this location in the journey" + }, + "s": { + "type": "integer", + "title": "Sequence Number", + "description": "The sequence at which this location sits in the schedule" + }, + "act": { + "title": "activities", + "description": "Activities carried out at this location", + "type": "string" + }, + "p": { + "title": "Platform", + "type": "string", + "description": "The platform that this event takes place" + }, + "pc": { + "title": "Platform Changed", + "type": "boolean" + }, + "pcn": { + "title": "Platform Confirmed", + "type": "boolean" + }, + "ps": { + "title": "Platform Surpressed", + "description": "Whether platform data is surpressed", + "type": "boolean" + }, + "can": { + "title": "Cancelled", + "description": "Whether this location is cancelled in the journey", + "type": "boolean" + }, + "al": { + "type": "integer", + "title": "Average Loading", + "description": "The average loading at this location" + }, + "fid": { + "type": "string", + "title": "Formation ID", + "description": "The formation ID at this location" + }, + "pta": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Public time of arrival" + }, + "wta": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Working time of arrival" + }, + "wtp": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Working time of pass" + }, + "ptd": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Public time of departure" + }, + "wtd": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Working time of departure" + }, + "eta": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Estimated time of arrival" + }, + "etd": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Estimated time of departure" + }, + "etp": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Estimated time of pass" + }, + "ata": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Actual time of arrival" + }, + "atd": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Actual time of departure" + }, + "atp": { + "$ref": "#/$defs/DateTimeTZ", + "title": "Actual time of pass" + } + }, + "required": ["t", "r", "s", "act"] + } + }, + "type": "object", + "required": ["header", "locations"], + "additionalProperties": false, + "properties": { + "header": { + "type": "object", + "additionalProperties": false, + "properties": { + "r": { + "type": "string", + "title": "RID", + "description": "The RID of the service", + "maxLength": 16 + }, + "u": { + "title": "UID", + "description": "The UID of the service", + "type": "string" + }, + "s": { + "title": "SSD", + "description": "The SSD of the service", + "type": "string", + "format": "date" + }, + "h": { + "title": "train_id", + "description": "Headcode", + "maxLength": 4, + "minLength": 4, + "type": "string" + }, + "t": { + "title": "TOC", + "description": "The TOC operating the service", + "type": "string", + "maxLength": 3, + "minLength": 2 + }, + "st": { + "title": "Status", + "description": "Train status", + "type": "string" + }, + "cr": { + "title": "Cancel Reason", + "type": "integer" + }, + "cl": { + "title": "Cancel Location", + "type": "string", + "maxLength": 7 + }, + "cn": { + "title": "Cancel Near", + "description": "Whether the train was cancelled NEAR the 'cancel_loation', else at the 'cancel_location'", + "type": "boolean" + }, + "dr": { + "title": "Delay Reason", + "type": "integer" + }, + "dl": { + "title": "Delay Location", + "type": "string", + "maxLength": 7 + }, + "dn": { + "title": "Delay Near", + "description": "Whether the train was delayed NEAR the 'delay_loation', else at the 'delay_location'", + "type": "boolean" + }, + "ip": { + "title": "is_passenger", + "description": "Whether this is a passenger service", + "type": "boolean" + }, + "ic": { + "title": "is_charter", + "description": "Whether this is a charter service", + "type": "boolean" + }, + "rs": { + "title": "RSID", + "description": "Retail Service ID", + "type": "string" + } + }, + "required": ["r", "s", "h", "t", "ip", "ic"] + }, + "locations": { + "type": "array", + "additionalItems": false, + "items": { + "$ref": "#/$defs/ServiceLocation" + } + } + } +} \ No newline at end of file