{
	"swagger": "2.0",
	"info": {
		"title": "Timetable Comparator Service",
		"version": "v2"
	},
	"paths": {
		"/api/v2/timetable/dailyDelta": {
			"get": {
				"description": "The Daily Delta request returns all differences found within the CIF timetable between two consecutive days. This request is ideal for TIS that would prefer to pull all changes and process the data locally.This request does not support a base date, so users of this request type would need to query the service daily. The daily delta file can be requested for a particular date using the Date field in the request. If the date is omitted, the latest file will always be returned.The response to this request will include a pre-signed, time sensitive S3 URL from where the daily delta can be downloaded. Trips that are held onto by the timetable stability check will not be included in the daily delta. Instead, these trips will be included in the delta on a subsequent day, depending on what parameters are defined within the timetable stability check.",
				"produces": [
					"application/json"
				],
				"parameters": [
					{
						"name": "Authorization",
						"description": "Bearer token",
						"required": true,
						"in": "header",
						"type": "string"
					},
					{
						"name": "client_id",
						"description": "Unique client id identifying the organisation making the request",
						"required": true,
						"in": "header",
						"type": "string"
					},
					{
						"name": "X-Correlation-Cust-Id",
						"description": "Unique client correlation id that can be used to trace requests",
						"required": false,
						"in": "header",
						"type": "string"
					},
					{
						"name": "Accept-Encoding",
						"description": "Indicates the content encoding that the client can understand. Specifying gzip will result in compressed (and faster) responses.",
						"required": false,
						"in": "header",
						"type": "string"
					},
					{
						"name": "User-Agent",
						"description": "Name and version number of system making the request, e.g. RDGRuntime/7.41.2",
						"required": true,
						"in": "header",
						"type": "string"
					},
					{
						"name": "date",
						"description": "The date query parameter to specify the date for which the daily timetable delta is required. If omitted, the latest delta will be returned.The date refers to the second date in the comparison. For example, if the date “2022-02-20” is used, the delta returned will contain changes in timetables between the 19th and the 20th.Value must conform to ISO 8601 standard for date, accepted format is YYYY-MM-DD.",
						"required": false,
						"in": "query",
						"type": "string"
					}
				],
				"responses": {
					"200": {
						"description": "Returns 200 in case of sucess.",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/DailyDeltaGet200Response"
						}
					},
					"400": {
						"description": "Returns 400 in case of bad request.",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/Errors"
						}
					},
					"404": {
						"description": "Returns 404 in case of no results.",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/Errors"
						}
					},
					"500": {
						"description": "Returns 500 in case of server Error.",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/Errors"
						}
					}
				}
			}
		},
		"/api/v2/timetable/serviceChanges": {
			"get": {
				"description": "Retrieve timetable changes for one trip for one or more travel dates.",
				"produces": [
					"application/json"
				],
				"parameters": [
					{
						"name": "Authorization",
						"description": "Bearer token",
						"required": true,
						"in": "header",
						"type": "string"
					},
					{
						"name": "client_id",
						"description": "Unique client id identifying the organisation making the request",
						"required": true,
						"in": "header",
						"type": "string"
					},
					{
						"name": "X-Correlation-Cust-Id",
						"description": "Unique client correlation id that can be used to trace requests",
						"required": false,
						"in": "header",
						"type": "string"
					},
					{
						"name": "Accept-Encoding",
						"description": "Indicates the content encoding that the client can understand. Specifying gzip will result in compressed (and faster) responses.",
						"required": false,
						"in": "header",
						"type": "string"
					},
					{
						"name": "User-Agent",
						"description": "Name and version number of system making the request, e.g. RDGRuntime/7.41.2",
						"required": true,
						"in": "header",
						"type": "string"
					},
					{
						"name": "comparisonStartDate",
						"description": "The base date for the comparison to start from.Usually this will be the booking date or the date when the reservation was last checked.The Comparator Service will retrieve all changes that occurred between the ComparisonStartDate and today.Value must conform to ISO 8601 standard for date, accepted format is YYYY-MM-DD.",
						"required": true,
						"in": "query",
						"type": "string"
					},
					{
						"name": "uid",
						"description": "The Unique ID (UID) of the service being requested.Either a UID or RSID must be specified.",
						"required": false,
						"in": "query",
						"type": "string"
					},
					{
						"name": "rsid",
						"description": "The Retail Service ID (RSID) of the service being requested.Either a UID or RSID must be specified.",
						"required": false,
						"in": "query",
						"type": "string"
					},
					{
						"name": "serviceOriginDates",
						"description": "The list of dates this service runs on for which the service should return comparison data.For service that cross midnight, this is the date on which the service first departed. At least one date must be specified.By including more than one date, comparisons for multiple service can be requested within a single service object.If the changes on multiple TravelDates are the same, they will be included in a single serviceChange in the response.Dates must conform to ISO 8601 standard for date, accepted format is YYYY-MM-DD.Multiple dates can be specified using comma (,) as delimiter",
						"required": true,
						"in": "query",
						"type": "string"
					},
					{
						"name": "stops",
						"description": "The TIPLOC8 or CRS code for each stop that the comparison service should return data for.If one or more stops are specified, the service will return all changes relevant for just those stops. Changes that occurred at other stops on the service will be omitted.This field would usually contain the origin and destination of the service. Changes that occur to stops before the origin, or after the destination, or passing/calling stations along the route would not be returned.The TIPLOC8 value includes the suffix used for a location within the CIF timetable. The suffix is used to differentiate between repeated stations on the same service.The multiple values can be specified using comma (,) as delimiter.",
						"required": false,
						"in": "query",
						"type": "string"
					},
					{
						"name": "includeStopDetails",
						"description": "Whether to include the details (CRS and NLC) of each stop that appears in the response.This is in addition to the TIPLOC8 code that will already be returned for each stop.",
						"required": false,
						"in": "query",
						"default": false,
						"type": "boolean"
					}
				],
				"responses": {
					"200": {
						"description": "List of service changes",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/ServiceChangesGet200Response"
						}
					},
					"400": {
						"description": "Returns 400 in case of bad request.",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/Errors"
						}
					},
					"404": {
						"description": "Returns 400 in case of no results.",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/Errors"
						}
					},
					"500": {
						"description": "Returns 500 in case of server Error.",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/Errors"
						}
					}
				}
			},
			"post": {
				"description": "Bulk retrieve timetable changes for one or more service using various travel dates and base dates. This method essentially allows to dump the list of distinct service within active bookings database.A maximum of 100 service per request are supported. Large requests will result in slower response times.",
				"consumes": [
					"application/json"
				],
				"produces": [
					"application/json"
				],
				"parameters": [
					{
						"name": "Authorization",
						"description": "Bearer token",
						"required": true,
						"in": "header",
						"type": "string"
					},
					{
						"name": "client_id",
						"description": "Unique client id identifying the organisation making the request",
						"required": true,
						"in": "header",
						"type": "string"
					},
					{
						"name": "X-Correlation-Cust-Id",
						"description": "Unique client correlation id that can be used to trace requests",
						"required": false,
						"in": "header",
						"type": "string"
					},
					{
						"name": "Accept-Encoding",
						"description": "Indicates the content encoding that the client can understand. Specifying gzip will result in compressed (and faster) responses.",
						"required": false,
						"in": "header",
						"type": "string"
					},
					{
						"name": "User-Agent",
						"description": "Name and version number of system making the request, e.g. RDGRuntime/7.41.2",
						"required": true,
						"in": "header",
						"type": "string"
					},
					{
						"x-amf-mediaType": "application/json",
						"in": "body",
						"name": "generated",
						"schema": {
							"$ref": "#/definitions/ServiceChangesPostRequest"
						}
					}
				],
				"responses": {
					"200": {
						"description": "The updated service changes",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/ServiceChangesPost200Response"
						}
					},
					"400": {
						"description": "Returns 404 in case of bad request.",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/Errors"
						}
					},
					"500": {
						"description": "Returns 500 in case of server Error.",
						"x-amf-mediaType": "application/json",
						"schema": {
							"$ref": "#/definitions/Errors"
						}
					}
				}
			}
		}
	},
	"definitions": {
		"DailyDeltaGet200Response": {
			"title": "The response for daily delta request",
			"description": "The URL of the daily delta file in S3 bucket",
			"type": "string",
			"example": "https://anypoint.mulesoft.com/exchange/460ba272-3c28-4b66-945c-bd76489aa245/tcs-eapi/minor/2.0/console/method/%23165",
			"minLength": 0,
			"maxLength": 255
		},
		"ServiceChanges": {
			"title": "The type defintion for service changes",
			"description": "Describes changes to a service with a given UID on a given set of dates. At least one of serviceNotRunning, attributeChanges, and stopChanges will be present.",
			"type": "object",
			"additionalProperties": true,
			"required": [
				"uid",
				"serviceOriginDates",
				"serviceDepartureTime",
				"serviceArrivalTime"
			],
			"properties": {
				"uid": {
					"description": "The UID for this trip.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"currentUID": {
					"description": "The current UID of the trip. Omitted if no UID changes detected.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"rsid": {
					"description": "The 6-character RSID of the trip.",
					"type": "string",
					"minLength": 0,
					"maxLength": 6
				},
				"currentRSID": {
					"description": "The current RSID for this trip. Omitted if no RSID changes detected.",
					"type": "string",
					"minLength": 0,
					"maxLength": 8
				},
				"serviceOriginDates": {
					"description": "The list of travel dates that this update is applicable for.",
					"type": "array",
					"items": {
						"$ref": "#/definitions/StringType"
					}
				},
				"comparisonStartDate": {
					"description": "The timetable changes returned represent all changes between this date and today. If this response originated from a GET TripChanges request, this field would contain the same value that is in the request. If this response originated from a DailyDelta request, this field would be omitted from the response.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"lastUpdatedOn": {
					"description": "The date of the latest change to this trip. If this response originated from a Daily Delta request, this field would be omitted from the response.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"serviceDepartureTime": {
					"description": "The previous time this service was scheduled to depart from its first stop formatted as HH:mm.If the departure time has changed, the current departure time can be found under stopChanges",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"serviceArrivalTime": {
					"description": "The previous time this service was scheduled to arrive at its last stop formatted as HH:mm. If the arrival time has changed, the current arrival time can be found under stopChanges.Hours may exceed 23 for service crossing midnight",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"serviceNotRunning": {
					"description": "True if this trip no longer runs on the ApplicableDays.",
					"type": "boolean"
				},
				"attributeChanges": {
					"description": "Array of trip attributes that have changed.",
					"type": "array",
					"items": {
						"$ref": "#/definitions/AttributeChange"
					}
				},
				"stopChanges": {
					"description": "A list of StopDetail objects containing the details of all the stops that appear in the TripChanges. Omitted when IncludeStopDetails not specified.",
					"type": "array",
					"items": {
						"$ref": "#/definitions/StopChange"
					}
				}
			}
		},
		"StringType": {
			"type": "string",
			"minLength": 0,
			"maxLength": 255
		},
		"ServiceChangesGet200Response": {
			"title": "The response for trip changes",
			"type": "object",
			"additionalProperties": true,
			"required": [
				"apiVersion"
			],
			"properties": {
				"apiVersion": {
					"description": "The version of the API schema to which this response conforms.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"status": {
					"title": "The type definition for Status",
					"description": "The response status.",
					"type": "object",
					"additionalProperties": true,
					"required": [
						"type"
					],
					"properties": {
						"message": {
							"type": "string",
							"minLength": 0,
							"maxLength": 255
						},
						"type": {
							"enum": [
								"Information",
								"Error"
							],
							"type": "string",
							"minLength": 5,
							"maxLength": 11
						}
					}
				},
				"serviceChanges": {
					"description": "A list of serviceChange objects representing every change that was found for the requested service.",
					"type": "array",
					"items": {
						"$ref": "#/definitions/ServiceChanges"
					}
				},
				"stopDetails": {
					"description": "A list of StopDetail objects containing the details of all the stops that appear in the TripChanges. Omitted when IncludeStopDetails not specified.",
					"type": "array",
					"items": {
						"$ref": "#/definitions/StopDetail"
					}
				}
			}
		},
		"ServiceChangesPost200Response": {
			"title": "The response for trip changes",
			"type": "object",
			"additionalProperties": true,
			"required": [
				"apiVersion"
			],
			"properties": {
				"apiVersion": {
					"description": "The version of the API schema to which this response conforms.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"status": {
					"title": "The type definition for Status",
					"description": "The response status.",
					"type": "object",
					"additionalProperties": true,
					"required": [
						"type"
					],
					"properties": {
						"message": {
							"type": "string",
							"minLength": 0,
							"maxLength": 255
						},
						"type": {
							"enum": [
								"Information",
								"Error"
							],
							"type": "string",
							"minLength": 5,
							"maxLength": 11
						}
					}
				},
				"serviceChanges": {
					"description": "A list of serviceChange objects representing every change that was found for the requested service.",
					"type": "array",
					"items": {
						"$ref": "#/definitions/ServiceChanges"
					}
				},
				"stopDetails": {
					"description": "A list of StopDetail objects containing the details of all the stops that appear in the TripChanges. Omitted when IncludeStopDetails not specified.",
					"type": "array",
					"items": {
						"$ref": "#/definitions/StopDetail"
					}
				}
			}
		},
		"ServiceChangesPostRequest": {
			"title": "The service changes bulk request type",
			"description": "Bulk retrieve timetable changes for one or more service using various travel dates and base dates.",
			"type": "object",
			"additionalProperties": true,
			"required": [
				"services"
			],
			"properties": {
				"services": {
					"description": "The list of service for which changes will be retrieved for.",
					"type": "array",
					"items": {
						"$ref": "#/definitions/Service"
					}
				},
				"includeStopDetails": {
					"description": "Whether to include the details (CRS and NLC) of each stop that appears in the response. This is in addition to the TIPLOC8 code that will already be returned for each stop. Defaults to false.",
					"type": "boolean"
				}
			}
		},
		"StopDetail": {
			"title": "The type defintion for stop details",
			"description": "Describes the CRS and NLC of a stop that appears in the response. For serviceChanges requests this is only included if includeStopDetails specified in the request.",
			"type": "object",
			"additionalProperties": true,
			"properties": {
				"extendedTiploc": {
					"description": "The TIPLCO8 of the stop.",
					"type": "string",
					"minLength": 0,
					"maxLength": 8
				},
				"crs": {
					"description": "The 3-character primary CRS code of this station.",
					"type": "string",
					"minLength": 0,
					"maxLength": 3
				},
				"nlc": {
					"description": "The 4-character NLC code of this station.",
					"type": "string",
					"minLength": 0,
					"maxLength": 4
				}
			}
		},
		"Service": {
			"title": "The type defintion for service request",
			"description": "Describes service request",
			"type": "object",
			"additionalProperties": true,
			"required": [
				"comparisonStartDate",
				"serviceOriginDates"
			],
			"properties": {
				"comparisonStartDate": {
					"description": "The base date for the comparison to start from.Usually this will be the booking date or the date when the reservation was last checked.The Comparator Service will retrieve all changes that occurred between the ComparisonStartDate and today. Value must conform to ISO 8601 standard for date, accepted format is YYYY-MM-DD..",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"uid": {
					"description": "The Unique ID (UID) of the service being requested. Either a UID or RSID must be specified..",
					"type": "string",
					"minLength": 0,
					"maxLength": 6
				},
				"rsid": {
					"description": "The Retail Service ID (RSID) of the service being requested. Either a UID or RSID must be specified..",
					"type": "string",
					"minLength": 0,
					"maxLength": 8
				},
				"serviceOriginDates": {
					"description": "The list of dates this service runs on for which the comparator service should return comparison data.For services that cross midnight, this is the date on which the service first departed. At least one date must be specified.By including more than one date, comparisons for multiple services can be requested within a single service object. If the changes on multiple ServiceOriginDates are the same, they will be included in a single serviceChange in the response. Dates must conform to ISO 8601 standard for date, accepted format is YYYY-MM-DD..",
					"type": "array",
					"items": {
						"$ref": "#/definitions/StringType"
					}
				},
				"callingPoints": {
					"description": "The TIPLOC or CRS code for each stop that the comparison service should return data for. If one or more stops are specified, the service will return all changes relevant for just those stops. Changes that occurred at other stops on the service will be omitted. This field would usually contain the origin and destination of the service. Changes that occur to stops before the origin, or after the destination, or passing/calling stations along the route would not be returned.",
					"type": "array",
					"items": {
						"$ref": "#/definitions/StringType"
					}
				}
			}
		},
		"AttributeChange": {
			"title": "The type defintion for service attribute changes",
			"description": "Defines a change in an attribute on a trip, such as whether the service requires reservations or not. Can apply across the whole trip or only to certain stops on the service. Here is the list of possible values returned in the PreviousValue and CurrentValue fields per Attribute.",
			"type": "object",
			"additionalProperties": true,
			"required": [
				"attribute"
			],
			"properties": {
				"attribute": {
					"description": "The name of the attribute that has changed.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"previousValue": {
					"description": "Previous value for this attribute. The value returned will depend on the value of the Attribute returned.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"value": {
					"description": "Current value for this attribute. The value returned will depend on the value of the Attribute returned.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"applicableStops": {
					"description": "Array of stops to which this change applies. Each stop is listed as a TIPLOC8.",
					"type": "array",
					"items": {
						"$ref": "#/definitions/StringType"
					}
				}
			}
		},
		"StopChange": {
			"title": "The type defintion for service stop changes",
			"description": "Describes the changes to a service at a given stop.",
			"type": "object",
			"additionalProperties": true,
			"required": [
				"extendedTiploc"
			],
			"properties": {
				"extendedTiploc": {
					"description": "TIPLOC of this stop followed by the index of this visit to this stop if the stop is visited more than once.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"previousPlatform": {
					"description": "The previous platform used by the service at this stop. Omitted if the platform has not changed.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"platform": {
					"description": "The current platform used by the service at this stop. Omitted if the platform has not changed.",
					"type": "string",
					"minLength": 0,
					"maxLength": 255
				},
				"cannotAlight": {
					"description": "True if the service no longer allows passenger to alight at this station. Exclusive with ArrivalTimeChange.",
					"type": "boolean"
				},
				"cannotBoard": {
					"description": "True if the service no longer allows passenger to board at this station. Exclusive with DepartureTimeChange.",
					"type": "boolean"
				},
				"arrivalTime": {
					"title": "The type defintion for trip time changes",
					"description": "Describes a change in the time a service arrives or departs from a stop.",
					"type": "object",
					"additionalProperties": true,
					"required": [
						"previousTiming",
						"timing"
					],
					"properties": {
						"previousTiming": {
							"description": "The previous arrival or departure time of this stop presented in hours and minutes. Formatted as \"HH:mm\". Note - Hours may exceed 23 for trip crossing midnight. The time will be shown in local time(not UTC).",
							"type": "string",
							"minLength": 0,
							"maxLength": 255
						},
						"timing": {
							"description": "The current arrival or departure time of this stop presented in hours and minutes. Formatted as \"HH:mm\".",
							"type": "string",
							"minLength": 0,
							"maxLength": 255
						}
					}
				},
				"departureTime": {
					"title": "The type defintion for trip time changes",
					"description": "Describes a change in the time a service arrives or departs from a stop.",
					"type": "object",
					"additionalProperties": true,
					"required": [
						"previousTiming",
						"timing"
					],
					"properties": {
						"previousTiming": {
							"description": "The previous arrival or departure time of this stop presented in hours and minutes. Formatted as \"HH:mm\". Note - Hours may exceed 23 for trip crossing midnight. The time will be shown in local time(not UTC).",
							"type": "string",
							"minLength": 0,
							"maxLength": 255
						},
						"timing": {
							"description": "The current arrival or departure time of this stop presented in hours and minutes. Formatted as \"HH:mm\".",
							"type": "string",
							"minLength": 0,
							"maxLength": 255
						}
					}
				}
			}
		},
		"Errors": {
			"title": "Error Array",
			"type": "object",
			"properties": {
				"errors": {
					"type": "array",
					"items": {
						"$ref": "#/definitions/Error"
					}
				}
			}
		},
		"Error": {
			"title": "RDG Error Object",
			"type": "object",
			"properties": {
				"code": {
					"title": "Error Code",
					"type": "string",
					"description": "A unique (by service) code for an error"
				},
				"message": {
					"title": "Error Message",
					"type": "string",
					"description": "Short description of an error"
				},
				"timestamp": {
					"title": "Error Timestamp",
					"type": "string",
					"format": "date-time",
					"description": "Timestamp of an error"
				},
				"context": {
					"title": "Context",
					"description": "Additional context in relation to the notice.",
					"type": "object",
					"patternProperties": {
						"[a-zA-Z0-9_]*": {
							"type": "string"
						}
					}
				}
			}
		}
	}
}