swagger: "2.0"
info:
  description: "A microserivce that provides the road planning functionality on the cloud"
  version: "2.0.0"
  title: "cloud_planner"
  contact:
    name: "Infra"
    email: "infrateam@zoox.com"
    url: "https://git.zooxlabs.com/zooxco/driving"
schemes:
  - "http"
  - "https"
basePath: /v2

paths:
  /mission_paths/:
    get:
      summary: "Provides the path to be taken by mission planner to reach the destination from start"
      x-swagger-router-controller: "dispatch.cloud_planner.controller"
      operationId: "findMissionPaths"
      produces:
        - application/json
      parameters:
        - in: "query"
          name: "from_latlon"
          type: "array"
          items:
            type: "number"
            format: "float"
          minItems: 2
          maxItems: 2
          required: true
          description: "Lat/Lon of starting point of path."
        - in: "query"
          name: "to_latlon"
          type: "array"
          items:
            type: "number"
            format: "float"
          minItems: 2
          maxItems: 2
          required: true
          description: "Lat/Lon of end point of path."
        - in: "query"
          name: "waypoint_latlons"
          type: "array"
          items:
            type: "number"
            format: "float"
          required: false
          default: []
          description: "Lat/Lons of mid/waypoints of path."
        - in: "query"
          description: "Whether to snap the start location."
          name: "snap_start"
          type: "boolean"
          required: false
          default: true
        - in: "query"
          name: "snap_end"
          description: "Whether to snap the end location."
          type: "boolean"
          required: false
          default: true
        - in: "query"
          name: "zrn_release_status"
          description: "The release status of the ZRN that the mission planner should use"
          type: "string"
          enum:
            - "kAlpha"
            - "kBeta"
            - "kReleased"
            - "kPointToPoint"
          required: false
      responses:
        "200":
          description: "Operation was successful."
          schema:
            $ref: "#/definitions/MissionPathList"
        "400":
          description: "Invalid parameter was provided."
          schema:
            $ref: "#/definitions/ErrorResponse"
        "404":
          description: "No route found."
          schema:
            $ref: "#/definitions/ErrorResponse"
        "500":
          description: "Unknown internal error."
          schema:
            $ref: "#/definitions/ErrorResponse"

definitions:
  Location:
    type: "object"
    description: "Provides location information"
    properties:
      latitude:
        type: "number"
        format: "double"
        description: "Latitude information for the location"
      longitude:
        type: "number"
        format: "double"
        description: "Longitude information for the location"
      altitudeMeters:
        type: "number"
        format: "double"
    required:
      - latitude
      - longitude
  MissionPath:
    type: "object"
    description: "Resource representing the path taken by the mission planner"
    properties:
      path:
        type: "array"
        items:
          $ref: "#/definitions/Location"
      costSeconds:
        type: "number"
        format: "double"
        description: "Provides the time in seconds needed to cover the distance the path"
      snappedStart:
        $ref: "#/definitions/Location"
      snappedEnd:
        $ref: "#/definitions/Location"
    required:
      - path
      - costSeconds
      - snappedStart
      - snappedEnd
  MissionPathList:
    type: "object"
    properties:
      items:
        type: "array"
        items:
          $ref: "#/definitions/MissionPath"
    required:
      - items
  ErrorResponse:
    type: "object"
    properties:
      message:
        description: "A message describing the error"
        type: "string"
