{
    "openapi": "3.1.2",
    "info": {
        "title": "Maize Bus Backend",
        "version": ""
    },
    "components": {
        "schemas": {
            "ProcessedJourney": {
                "type": "object",
                "properties": {
                    "legs": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/FormattedLeg"
                        }
                    },
                    "arrivalTime": {
                        "type": "number"
                    },
                    "departureTime": {
                        "type": "number"
                    },
                    "criteria": {
                        "type": "object",
                        "properties": {
                            "arrivalTime": {
                                "type": "number"
                            },
                            "walkingDistance": {
                                "type": "number"
                            },
                            "transferCount": {
                                "type": "number"
                            }
                        },
                        "required": [
                            "arrivalTime",
                            "walkingDistance",
                            "transferCount"
                        ],
                        "additionalProperties": false
                    }
                },
                "required": [
                    "legs",
                    "arrivalTime",
                    "departureTime",
                    "criteria"
                ],
                "additionalProperties": false
            },
            "FormattedLeg": {
                "oneOf": [
                    {
                        "$ref": "#/components/schemas/FormattedLegWalk"
                    },
                    {
                        "$ref": "#/components/schemas/FormattedLegBus"
                    }
                ]
            },
            "FormattedLegWalk": {
                "type": "object",
                "properties": {
                    "origin_id": {
                        "type": "string"
                    },
                    "origin": {
                        "type": "string"
                    },
                    "destination_id": {
                        "type": "string"
                    },
                    "destination": {
                        "type": "string"
                    },
                    "destinationName": {
                        "type": "string"
                    },
                    "startTime": {
                        "type": "number"
                    },
                    "endTime": {
                        "type": "number"
                    },
                    "duration": {
                        "type": "number"
                    },
                    "path_coords": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/LatLon"
                        }
                    },
                    "mode": {
                        "type": "string",
                        "const": "walk"
                    }
                },
                "required": [
                    "origin_id",
                    "origin",
                    "destination_id",
                    "destination",
                    "destinationName",
                    "startTime",
                    "endTime",
                    "duration",
                    "path_coords",
                    "mode"
                ],
                "additionalProperties": false
            },
            "LatLon": {
                "type": "object",
                "properties": {
                    "lat": {
                        "type": "number"
                    },
                    "lon": {
                        "type": "number"
                    }
                },
                "required": [
                    "lat",
                    "lon"
                ],
                "additionalProperties": false
            },
            "FormattedLegBus": {
                "type": "object",
                "properties": {
                    "origin_id": {
                        "type": "string"
                    },
                    "origin": {
                        "type": "string"
                    },
                    "destination_id": {
                        "type": "string"
                    },
                    "destination": {
                        "type": "string"
                    },
                    "destinationName": {
                        "type": "string"
                    },
                    "startTime": {
                        "type": "number"
                    },
                    "endTime": {
                        "type": "number"
                    },
                    "duration": {
                        "type": "number"
                    },
                    "busPathSegments": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/FormattedLegBusPathRouteSegment"
                        }
                    },
                    "stopCoords": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/FormattedLegBusStopCoord"
                        }
                    },
                    "mode": {
                        "type": "string",
                        "const": "bus"
                    },
                    "stopTimes": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/StopTime"
                        }
                    },
                    "trip": {
                        "$ref": "#/components/schemas/Trip"
                    },
                    "tripId": {
                        "type": "string"
                    },
                    "rt": {
                        "type": "string"
                    },
                    "vid": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                },
                "required": [
                    "origin_id",
                    "origin",
                    "destination_id",
                    "destination",
                    "destinationName",
                    "startTime",
                    "endTime",
                    "duration",
                    "busPathSegments",
                    "stopCoords",
                    "mode",
                    "stopTimes",
                    "trip",
                    "tripId",
                    "rt",
                    "vid"
                ],
                "additionalProperties": false
            },
            "FormattedLegBusPathRouteSegment": {
                "type": "object",
                "properties": {
                    "rt": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "path": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/LatLon"
                        }
                    }
                },
                "required": [
                    "rt",
                    "path"
                ],
                "additionalProperties": false
            },
            "FormattedLegBusStopCoord": {
                "type": "object",
                "properties": {
                    "rt": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "location": {
                        "$ref": "#/components/schemas/LatLon"
                    }
                },
                "required": [
                    "rt",
                    "location"
                ],
                "additionalProperties": false
            },
            "StopTime": {
                "type": "object",
                "properties": {
                    "stop": {
                        "type": "string"
                    },
                    "arrivalTime": {
                        "type": "number"
                    },
                    "departureTime": {
                        "type": "number"
                    },
                    "pickUp": {
                        "type": "boolean"
                    },
                    "dropOff": {
                        "type": "boolean"
                    }
                },
                "required": [
                    "stop",
                    "arrivalTime",
                    "departureTime",
                    "pickUp",
                    "dropOff"
                ],
                "additionalProperties": false
            },
            "Trip": {
                "type": "object",
                "properties": {
                    "tripId": {
                        "type": "string"
                    },
                    "vid": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "stopTimes": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/StopTime"
                        }
                    }
                },
                "required": [
                    "tripId",
                    "vid",
                    "stopTimes"
                ],
                "additionalProperties": false
            },
            "Token": {
                "type": "string"
            },
            "Reminder": {
                "type": "object",
                "properties": {
                    "stpid": {
                        "type": "string"
                    },
                    "rtid": {
                        "type": "string"
                    },
                    "thresh": {
                        "anyOf": [
                            {
                                "type": "number"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    },
                    "eta": {
                        "anyOf": [
                            {
                                "type": "number"
                            },
                            {
                                "type": "null"
                            }
                        ]
                    }
                },
                "required": [
                    "stpid",
                    "rtid",
                    "thresh",
                    "eta"
                ],
                "additionalProperties": false
            },
            "FloorPlanVisuals": {
                "type": "object",
                "properties": {
                    "points": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Point"
                        }
                    },
                    "areas": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Area"
                        }
                    },
                    "boundingBox": {
                        "type": "object",
                        "properties": {
                            "sw": {
                                "$ref": "#/components/schemas/LatLon"
                            },
                            "ne": {
                                "$ref": "#/components/schemas/LatLon"
                            }
                        },
                        "required": [
                            "sw",
                            "ne"
                        ],
                        "additionalProperties": false
                    }
                },
                "required": [
                    "points",
                    "areas",
                    "boundingBox"
                ],
                "additionalProperties": false
            },
            "Point": {
                "type": "object",
                "properties": {
                    "x": {
                        "type": "number"
                    },
                    "y": {
                        "type": "number"
                    }
                },
                "required": [
                    "x",
                    "y"
                ],
                "additionalProperties": false,
                "description": "increasing `x` represents going northward, increasing `y` represents going eastward"
            },
            "Area": {
                "type": "object",
                "properties": {
                    "polygon": {
                        "type": "array",
                        "items": {
                            "type": "number"
                        },
                        "description": "indexes into `points`, adjacent points (1st and last included) have an edge between them"
                    },
                    "classification": {
                        "type": "string",
                        "enum": [
                            "hallway",
                            "classroom",
                            "bathroom",
                            "stairway",
                            "elevator"
                        ]
                    },
                    "label": {
                        "anyOf": [
                            {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "const": "text"
                                    },
                                    "value": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "type",
                                    "value"
                                ],
                                "additionalProperties": false
                            },
                            {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "const": "icon"
                                    },
                                    "of": {
                                        "type": "string",
                                        "enum": [
                                            "bathroomWomen",
                                            "bathroomMen",
                                            "bathroomNeutral",
                                            "information",
                                            "food",
                                            "stairs",
                                            "escalator",
                                            "elevator"
                                        ]
                                    }
                                },
                                "required": [
                                    "type",
                                    "of"
                                ],
                                "additionalProperties": false
                            }
                        ]
                    },
                    "labelPos": {
                        "$ref": "#/components/schemas/Point"
                    },
                    "doors": {
                        "type": "array",
                        "items": {
                            "type": "number"
                        },
                        "description": "indexes into `polygon`, orientation determined by neighboring edges"
                    }
                },
                "required": [
                    "polygon",
                    "classification",
                    "label",
                    "labelPos",
                    "doors"
                ],
                "additionalProperties": false
            },
            "BusRouteLine": {
                "type": "object",
                "properties": {
                    "routeId": {
                        "type": "string"
                    },
                    "routeDirection": {
                        "type": "string"
                    },
                    "points": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/LatLon"
                        }
                    },
                    "stops": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "index": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                },
                                "stop": {
                                    "$ref": "#/components/schemas/BusStop"
                                }
                            },
                            "required": [
                                "index",
                                "stop"
                            ],
                            "additionalProperties": false
                        }
                    }
                },
                "required": [
                    "routeId",
                    "routeDirection",
                    "points",
                    "stops"
                ],
                "additionalProperties": false
            },
            "BusStop": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "location": {
                        "$ref": "#/components/schemas/LatLon"
                    },
                    "routeId": {
                        "type": "string"
                    },
                    "rotation": {
                        "type": "number"
                    },
                    "isRide": {
                        "type": "boolean"
                    }
                },
                "required": [
                    "id",
                    "name",
                    "location",
                    "routeId",
                    "rotation",
                    "isRide"
                ],
                "additionalProperties": false
            }
        }
    },
    "paths": {
        "/mbus/api/v3/plan-journey": {
            "get": {
                "summary": "",
                "description": "Plans a journey between origin and destination coordinates.",
                "parameters": [
                    {
                        "name": "originLat",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "originLon",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "destLat",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "destLon",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "walkingPenalty",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "range",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "number"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "journeys": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/ProcessedJourney"
                                            }
                                        }
                                    },
                                    "required": [
                                        "journeys"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    }
                }
            }
        },
        "/mbus/api/v3/setReminder": {
            "post": {
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "token": {
                                        "type": "string"
                                    },
                                    "stpid": {
                                        "type": "string"
                                    },
                                    "rtid": {
                                        "type": "string"
                                    },
                                    "thresh": {
                                        "type": "number"
                                    }
                                },
                                "required": [
                                    "token",
                                    "stpid",
                                    "rtid",
                                    "thresh"
                                ],
                                "additionalProperties": false
                            }
                        }
                    },
                    "required": true
                },
                "summary": "",
                "description": "",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "success"
                    }
                }
            }
        },
        "/mbus/api/v3/activeReminders/{token}": {
            "get": {
                "summary": "active reminders",
                "description": "big long description idk, gets the reminders associated with a **registration token**, which is gotten from fcm or smth",
                "parameters": [
                    {
                        "name": "token",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "reminders": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Reminder"
                                            }
                                        }
                                    },
                                    "required": [
                                        "reminders"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    }
                }
            }
        },
        "/mbus/api/v3/indoor/visuals": {
            "get": {
                "summary": "",
                "description": "",
                "parameters": [
                    {
                        "name": "buildingId",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "floor",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "points": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Point"
                                            }
                                        },
                                        "areas": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Area"
                                            }
                                        },
                                        "boundingBox": {
                                            "type": "object",
                                            "properties": {
                                                "sw": {
                                                    "$ref": "#/components/schemas/LatLon"
                                                },
                                                "ne": {
                                                    "$ref": "#/components/schemas/LatLon"
                                                }
                                            },
                                            "required": [
                                                "sw",
                                                "ne"
                                            ],
                                            "additionalProperties": false
                                        }
                                    },
                                    "required": [
                                        "points",
                                        "areas",
                                        "boundingBox"
                                    ],
                                    "additionalProperties": false
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v4/all-mbus-routes": {
            "get": {
                "summary": "",
                "description": "get all cached route patterns",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/BusRouteLine"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v4/all-ride-routes": {
            "get": {
                "summary": "",
                "description": "get all cached ride route patterns",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/BusRouteLine"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}