> ## Documentation Index
> Fetch the complete documentation index at: https://developers.kardinal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve a plan solution



## OpenAPI

````yaml /openapi.yaml get /plans/{planId}/solution
openapi: 3.0.3
info:
  title: Kardinal Builder API
  version: 1.0.0
  description: >
    This document specifies the REST API of Kardinal for builder users.


    Every endpoint applies to the single agency carried by the access token
    (either the sandbox

    agency or the production agency), which is why no agency id appears in the
    paths. An access

    token that does not grant access to exactly one agency is rejected with a
    `403`.
  contact:
    url: https://kardinal.ai/
    email: contact@kardinal.ai
servers:
  - url: /api/v2
security:
  - access_token: []
tags:
  - name: Plan
    description: How to create, retrieve, update and delete plans.
  - name: Solution
    description: How to retrieve the solution of a plan and its objectives.
  - name: Webhook
    description: How to create, retrieve, update and delete webhooks on a plan.
paths:
  /plans/{planId}/solution:
    parameters:
      - $ref: '#/components/parameters/planId'
    get:
      tags:
        - Solution
      summary: Retrieve a plan solution
      operationId: getPlanSolution
      responses:
        '200':
          description: Solution response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvelopedSolution'
        '401':
          $ref: '#/components/responses/NotAuthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    planId:
      name: planId
      description: The plan UUID.
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/UUID'
  schemas:
    EnvelopedSolution:
      type: object
      properties:
        item:
          $ref: '#/components/schemas/Solution'
        agencyId:
          $ref: '#/components/schemas/AgencyId'
        planId:
          $ref: '#/components/schemas/PlanId'
        planVersion:
          $ref: '#/components/schemas/PlanVersion'
    UUID:
      type: string
      format: uuid
      description: Universally Unique Identifier.
      pattern: >-
        ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
      example: cd4ce4e3-0208-4b10-b346-25f235214e4f
      readOnly: true
    Solution:
      type: object
      readOnly: true
      properties:
        agencyId:
          $ref: '#/components/schemas/AgencyId'
        planId:
          $ref: '#/components/schemas/PlanId'
        planVersion:
          $ref: '#/components/schemas/PlanVersion'
        timestamp:
          allOf:
            - $ref: '#/components/schemas/DateTime'
        unaffectedStopIds:
          type: array
          uniqueItems: true
          items:
            type: string
            allOf:
              - $ref: '#/components/schemas/RegexIdValidation'
        unaffectedAlternativeIds:
          type: array
          uniqueItems: true
          items:
            type: string
            allOf:
              - $ref: '#/components/schemas/RegexIdValidation'
        unusedResourceIds:
          type: array
          uniqueItems: true
          items:
            type: string
            allOf:
              - $ref: '#/components/schemas/RegexIdValidation'
        objectives:
          type: array
          items:
            $ref: '#/components/schemas/SolutionObjective'
          example:
            - name: maximizeMandatoryStops
              priority: 1
              direction: maximize
              value: 232
            - name: minimizeDelay
              direction: minimize
              value: 3600
            - name: minimizeResources
              priority: 0
              direction: minimize
              value: 232
            - name: maximizeOptionalStops
              priority: 0
              direction: maximize
              value: 232
            - name: minimizeLargestTourDuration
              priority: 0
              direction: minimize
              value: 1000
            - name: minimizeWorkingDuration
              priority: 0
              direction: minimize
              value: 83430
            - name: minimizeDistance
              priority: 0
              direction: minimize
              value: 88232.4
        tours:
          type: array
          uniqueItems: true
          items:
            $ref: '#/components/schemas/Tour'
        totalDelay:
          description: Total delay of the solution related to the preferred time windows.
          allOf:
            - $ref: '#/components/schemas/Duration'
        emptyDistanceInKm:
          description: >
            Total distance (in kilometers) traveled by all resources while
            "empty".
          type: number
          format: float
          example: 123.45
        CO2Emission:
          description: >
            Total CO2 emissions of the solution (sum of each tour's
            `CO2Emission`).

            Present only when at least one resource has a
            `CO2EmissionCalculation` (either on the resource itself or via
            `CO2EmissionCalculationByResourceTag` on the plan).
          type: number
          format: float
          example: 67890.1
        totalTollCostsByCurrency:
          description: >-
            Total toll costs of the solution, by currency code (sum of each
            tour's `tollCostsByCurrency`).
          allOf:
            - $ref: '#/components/schemas/CostsByCurrency'
        globalViolations:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/GlobalViolationMaxCumulatedCost'
    AgencyId:
      type: string
      description: The agency id.
      readOnly: true
      pattern: ^BLD[0-9]{7}_[a-zA-Z0-9-._~:@!$,]+$
      example: BLD1234567_production
    PlanId:
      description: The plan id.
      readOnly: true
      example: 4cbd0ab8-282c-4b30-b981-29e1ed8a2016
      allOf:
        - $ref: '#/components/schemas/UUID'
    PlanVersion:
      type: integer
      description: The plan version.
      readOnly: true
      minimum: 1
      example: 42
    EnvelopedErrors:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
    DateTime:
      type: string
      description: >-
        A full calendar date time, expressed in the ISO8601 **date** format:
        YYYY-MM-DDThh:mm:ssZ.
      example: '2019-11-15T12:34:56Z'
    RegexIdValidation:
      type: string
      description: >-
        At least one character among those allowed: unaccented alpha-numeric
        characters, "-", ".", "_", "~", ":", "@", "!", "$", ",".
      pattern: ^[a-zA-Z0-9-._~:@!$,]+$
    SolutionObjective:
      type: object
      properties:
        name:
          type: string
          allOf:
            - $ref: '#/components/schemas/RegexIdValidation'
        priority:
          type: integer
        direction:
          $ref: '#/components/schemas/OptimizationDirection'
        value:
          type: number
    Tour:
      type: object
      properties:
        resourceId:
          type: string
          allOf:
            - $ref: '#/components/schemas/RegexIdValidation'
        mode:
          $ref: '#/components/schemas/ResourceMode'
        distanceInKm:
          type: number
        emptyDistanceInKm:
          description: >
            Distance (in kilometers) traveled by this resource while "empty"
            (i.e., with all capacities below their respective thresholds).
          type: number
          format: float
          example: 10.5
        tourCost:
          type: number
        tollCostsByCurrency:
          description: Toll costs of this tour, by currency code.
          allOf:
            - $ref: '#/components/schemas/CostsByCurrency'
        CO2Emission:
          description: >
            Total CO2 emissions of this tour, based on the given definition in
            `CO2EmissionCalculation`.

            Present only when the resource has a `CO2EmissionCalculation`
            (either on the resource itself or via
            `CO2EmissionCalculationByResourceTag` on the plan).
          type: number
          format: float
          example: 12345.6
        totalDelay:
          description: Total delay of the tour related to the preferred time windows.
          allOf:
            - $ref: '#/components/schemas/Duration'
        travelDuration:
          $ref: '#/components/schemas/Duration'
        workingDuration:
          $ref: '#/components/schemas/Duration'
        waitingDuration:
          $ref: '#/components/schemas/Duration'
        resourceCapacities:
          description: >-
            List of capacities and associated quantity for which the resource
            has a restriction on the quantity to be carried at each stop during
            the tour.
          allOf:
            - $ref: '#/components/schemas/Capacities'
        maxFilledCapacities:
          description: >-
            List of each capacity transported by the resource, as well as the
            maximum quantity reached for this capacity at a stop during the
            tour.
          allOf:
            - $ref: '#/components/schemas/Capacities'
        filledCapacitiesAtBegin:
          $ref: '#/components/schemas/Capacities'
        filledCapacitiesAtEnd:
          $ref: '#/components/schemas/Capacities'
        isValid:
          description: Indicates whether the tour satisfies all resource constraints.
          type: boolean
        violations:
          type: array
          items:
            $ref: '#/components/schemas/TourViolation'
          description: List of the Tour's violations.
        wayPoints:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/WayPointBegin'
              - $ref: '#/components/schemas/WayPointStop'
              - $ref: '#/components/schemas/WayPointBreak'
              - $ref: '#/components/schemas/WayPointEnd'
        vehicleProfile:
          oneOf:
            - $ref: '#/components/schemas/VehicleProfileFly'
            - $ref: '#/components/schemas/VehicleProfilePedestrian'
            - $ref: '#/components/schemas/VehicleProfileBicycle'
            - $ref: '#/components/schemas/VehicleProfileScooter'
            - $ref: '#/components/schemas/VehicleProfileMotorbike'
            - $ref: '#/components/schemas/VehicleProfileCar'
            - $ref: '#/components/schemas/VehicleProfileTruck'
    Duration:
      type: string
      description: A period of time, expressed in the ISO8601 **duration** format.
      pattern: ^P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$
      example: PT4M
    CostsByCurrency:
      type: object
      description: >
        Cost ranges mapped by currency code. Each currency code is a
        three-letter

        string following the ISO 4217 specification (e.g. `EUR`, `CHF`).

        See https://en.wikipedia.org/wiki/ISO_4217 for more details.
      readOnly: true
      additionalProperties:
        $ref: '#/components/schemas/CostRange'
      example:
        EUR:
          min: 42.15
          max: 58.6
        CHF:
          min: 13.22
          max: 13.22
    GlobalViolationMaxCumulatedCost:
      type: object
      description: Violation linked to a MaxCumulatedCost global constraint.
      properties:
        type:
          type: string
          enum:
            - maxCumulatedCost
        name:
          type: string
        resourceIds:
          type: array
          uniqueItems: true
          items:
            type: string
            allOf:
              - $ref: '#/components/schemas/RegexIdValidation'
        maximum:
          type: number
        exceededCost:
          type: number
    Error:
      type: object
      readOnly: true
      properties:
        code:
          type: string
        message:
          type: string
        properties:
          $ref: '#/components/schemas/ErrorProperties'
      required:
        - message
        - code
    OptimizationDirection:
      type: string
      enum:
        - minimize
        - maximize
    ResourceMode:
      type: string
      enum:
        - free
        - fixed
      default: free
    Capacities:
      type: object
      additionalProperties:
        type: number
      example:
        volume: 9.5
        weight: 2200
        nbPackages: 23
    TourViolation:
      description: Semantic violations, can be handled "generically" or specifically.
      oneOf:
        - $ref: '#/components/schemas/BeginViolation'
        - $ref: '#/components/schemas/EndViolation'
        - $ref: '#/components/schemas/SkillsViolation'
        - $ref: '#/components/schemas/ForbiddenAssignmentViolation'
        - $ref: '#/components/schemas/AuthorizedTimeWindowViolation'
        - $ref: '#/components/schemas/CapacityViolation'
        - $ref: '#/components/schemas/AtLeastOneValidCapacityViolation'
        - $ref: '#/components/schemas/SuccessiveStopsViolation'
        - $ref: '#/components/schemas/OrderViolation'
        - $ref: '#/components/schemas/MaxStopSpanViolation'
        - $ref: '#/components/schemas/WorkingTimeWindowViolation'
        - $ref: '#/components/schemas/MaxWorkingDurationViolation'
        - $ref: '#/components/schemas/MaxDistanceInKmViolation'
        - $ref: '#/components/schemas/MaxInterStopDistanceInKmViolation'
        - $ref: '#/components/schemas/MaxInterStopDurationViolation'
        - $ref: '#/components/schemas/StopIncompatibilityViolation'
        - $ref: '#/components/schemas/AtLeastOneConstraintViolation'
        - $ref: '#/components/schemas/MaxStopTagGroupsViolation'
        - $ref: '#/components/schemas/RemovalStrategyViolation'
    WayPointBegin:
      type: object
      properties:
        type:
          type: string
          enum:
            - begin
        position:
          $ref: '#/components/schemas/Position'
        status:
          example: fixed
          allOf:
            - $ref: '#/components/schemas/WayPointStatus'
        departureTime:
          $ref: '#/components/schemas/DateTime'
        violations:
          type: array
          items:
            $ref: '#/components/schemas/WaypointViolation'
          description: List of the Waypoint's violations.
        fromPrevious:
          $ref: '#/components/schemas/FromPrevious'
      required:
        - type
        - position
    WayPointStop:
      type: object
      properties:
        type:
          type: string
          enum:
            - stop
        stopId:
          type: string
          allOf:
            - $ref: '#/components/schemas/RegexIdValidation'
        position:
          $ref: '#/components/schemas/Position'
        status:
          example: optimized
          allOf:
            - $ref: '#/components/schemas/WayPointStatus'
        stopProperties:
          $ref: '#/components/schemas/Properties'
        orderProperties:
          $ref: '#/components/schemas/Properties'
        filledCapacitiesAfterStop:
          $ref: '#/components/schemas/Capacities'
        delay:
          description: Delay related to the stop's preferred time windows.
          allOf:
            - $ref: '#/components/schemas/Duration'
        arrivalTime:
          $ref: '#/components/schemas/DateTime'
        beginTime:
          $ref: '#/components/schemas/DateTime'
        departureTime:
          $ref: '#/components/schemas/DateTime'
        violations:
          type: array
          items:
            $ref: '#/components/schemas/WaypointViolation'
          description: List of the Waypoint's violations.
        fromPrevious:
          $ref: '#/components/schemas/FromPrevious'
        stopKind:
          $ref: '#/components/schemas/StopKind'
      required:
        - type
        - position
    WayPointBreak:
      type: object
      properties:
        type:
          type: string
          enum:
            - break
        status:
          example: optimized
          allOf:
            - $ref: '#/components/schemas/WayPointStatus'
        arrivalTime:
          $ref: '#/components/schemas/DateTime'
        departureTime:
          $ref: '#/components/schemas/DateTime'
        violations:
          type: array
          items:
            $ref: '#/components/schemas/WaypointViolation'
          description: List of the Waypoint's violations.
        fromPrevious:
          $ref: '#/components/schemas/FromPrevious'
      required:
        - type
    WayPointEnd:
      type: object
      properties:
        type:
          type: string
          enum:
            - end
        position:
          $ref: '#/components/schemas/Position'
        status:
          example: optimized
          allOf:
            - $ref: '#/components/schemas/WayPointStatus'
        arrivalTime:
          $ref: '#/components/schemas/DateTime'
        violations:
          type: array
          items:
            $ref: '#/components/schemas/WaypointViolation'
          description: List of the Waypoint's violations.
        fromPrevious:
          $ref: '#/components/schemas/FromPrevious'
      required:
        - type
        - position
    VehicleProfileFly:
      type: object
      properties:
        type:
          type: string
          enum:
            - fly
        kmph:
          type: number
      required:
        - type
    VehicleProfilePedestrian:
      type: object
      properties:
        type:
          type: string
          enum:
            - pedestrian
        avoidFerry:
          type: boolean
        avoidSeasonalClosure:
          type: boolean
        avoidDirtRoad:
          type: boolean
        excludedCountries:
          $ref: '#/components/schemas/CountryCodes'
      required:
        - type
    VehicleProfileBicycle:
      type: object
      properties:
        type:
          type: string
          enum:
            - bicycle
        avoidFerry:
          type: boolean
        avoidSeasonalClosure:
          type: boolean
        avoidTunnel:
          type: boolean
        avoidDirtRoad:
          type: boolean
        excludedCountries:
          $ref: '#/components/schemas/CountryCodes'
      required:
        - type
    VehicleProfileScooter:
      type: object
      properties:
        type:
          type: string
          enum:
            - scooter
        avoidFerry:
          type: boolean
        avoidSeasonalClosure:
          type: boolean
        avoidCarShuttleTrain:
          type: boolean
        avoidTunnel:
          type: boolean
        avoidDirtRoad:
          type: boolean
        excludedCountries:
          $ref: '#/components/schemas/CountryCodes'
        speedCap:
          type: number
      required:
        - type
    VehicleProfileMotorbike:
      type: object
      properties:
        type:
          type: string
          enum:
            - motorbike
        avoidFerry:
          type: boolean
        avoidSeasonalClosure:
          type: boolean
        avoidControlledAccessHighway:
          type: boolean
        avoidCarShuttleTrain:
          type: boolean
        avoidTunnel:
          type: boolean
        avoidDirtRoad:
          type: boolean
        excludedCountries:
          $ref: '#/components/schemas/CountryCodes'
        speedCap:
          type: number
      required:
        - type
    VehicleProfileCar:
      type: object
      properties:
        type:
          type: string
          enum:
            - car
        withTraffic:
          type: boolean
        avoidTollRoad:
          type: boolean
        avoidFerry:
          type: boolean
        avoidSeasonalClosure:
          type: boolean
        avoidControlledAccessHighway:
          type: boolean
        avoidCarShuttleTrain:
          type: boolean
        avoidTunnel:
          type: boolean
        avoidDirtRoad:
          type: boolean
        avoidUTurns:
          type: boolean
        excludedCountries:
          $ref: '#/components/schemas/CountryCodes'
        speedCap:
          type: number
      required:
        - type
    VehicleProfileTruck:
      type: object
      properties:
        type:
          type: string
          enum:
            - truck
        grossWeight:
          type: number
        withTraffic:
          type: boolean
        avoidTollRoad:
          type: boolean
        avoidFerry:
          type: boolean
        avoidSeasonalClosure:
          type: boolean
        avoidControlledAccessHighway:
          type: boolean
        avoidCarShuttleTrain:
          type: boolean
        avoidTunnel:
          type: boolean
        avoidDirtRoad:
          type: boolean
        avoidUTurns:
          type: boolean
        shippedHazardousGoods:
          type: array
          items:
            $ref: '#/components/schemas/ShippedHazardousGood'
          example:
            - explosive
            - gas
            - flammable
        excludedCountries:
          $ref: '#/components/schemas/CountryCodes'
        height:
          type: number
        width:
          type: number
        length:
          type: number
        tunnelCategory:
          $ref: '#/components/schemas/TunnelCategory'
        speedCap:
          type: number
      required:
        - type
    CostRange:
      type: object
      description: A range of cost values (min equals max when the cost is a fixed value).
      readOnly: true
      properties:
        min:
          type: number
          description: The minimum cost
          example: 42.15
        max:
          type: number
          description: The maximum cost
          example: 58.6
      required:
        - min
        - max
    ErrorProperties:
      type: object
      additionalProperties:
        type: string
    BeginViolation:
      type: object
      description: Violation of a warehouse Constraint at the begining of a Tour.
      properties:
        type:
          type: string
          description: The violation's type.
          enum:
            - begin
        wayPointIndex:
          type: integer
          description: The idx of the waypoint the violation applies to.
          example: 0
      required:
        - type
    EndViolation:
      type: object
      description: Violation of a warehouse Constraint at the end of a Tour.
      properties:
        type:
          type: string
          enum:
            - end
        wayPointIndex:
          type: integer
          description: The idx of the waypoint the violation applies to.
          example: 0
      required:
        - type
    SkillsViolation:
      type: object
      description: Violation of a Skill constraint.
      properties:
        type:
          type: string
          enum:
            - skills
        wayPointIndex:
          type: integer
          description: The idx of the waypoint the violation applies to.
          example: 0
        lackingSkills:
          type: array
          description: >-
            The list of skills needed to do the waypoint that the resource
            lacks.
          items:
            type: string
            allOf:
              - $ref: '#/components/schemas/RegexIdValidation'
          example:
            - forklift
            - truck
      required:
        - type
    ForbiddenAssignmentViolation:
      type: object
      description: Violation of a ForbiddenAssignment constraint.
      properties:
        type:
          type: string
          enum:
            - forbiddenAssignment
        wayPointIndex:
          type: integer
          description: The idx of the waypoint the violation applies to.
          example: 0
        forbiddenAssignments:
          type: array
          items:
            $ref: '#/components/schemas/ForbiddenAssignment'
          description: >-
            The list of forbidden assignments that are violated with the
            waypoint assigned to the resource.
      required:
        - type
    AuthorizedTimeWindowViolation:
      type: object
      description: Violation of a stop's TimeWindow constraint.
      properties:
        type:
          type: string
          enum:
            - authorizedTimeWindow
        wayPointIndex:
          type: integer
          description: The idx of the waypoint the violation applies to.
          example: 0
        forbiddenWindow:
          description: The violated forbidden window.
          allOf:
            - $ref: '#/components/schemas/TimeWindow'
        actualTime:
          description: The time at which the waypoint is actually executed.
          allOf:
            - $ref: '#/components/schemas/DateTime'
      required:
        - type
        - forbiddenWindow
        - actualTime
    CapacityViolation:
      type: object
      description: Violation of a resource's capacity constraint.
      properties:
        type:
          type: string
          enum:
            - capacity
        wayPointIndex:
          type: integer
          description: The idx of the waypoint the violation applies to.
          example: 0
        capacity:
          type: string
          description: The capacity's name the constraint is linked to.
        overCapacity:
          description: The exceeding capacity.
          type: number
      required:
        - type
        - capacity
        - overCapacity
    AtLeastOneValidCapacityViolation:
      type: object
      description: Violation of a AtLeastOneValidCapacity constraint.
      properties:
        type:
          type: string
          enum:
            - atLeastOneValidCapacity
        wayPointIndex:
          type: integer
          description: The idx of the waypoint the violation applies to.
          example: 0
        name:
          description: >-
            The name of the AtLeastOneValidCapacity constraint the violation is
            linked to.
          type: string
        overCapacities:
          $ref: '#/components/schemas/Capacities'
      required:
        - type
        - name
        - overCapacities
    SuccessiveStopsViolation:
      type: object
      description: Violation of a order's succesive stops constraint.
      properties:
        type:
          type: string
          enum:
            - successiveStops
        expectedSuccessiveStopIds:
          description: The stop ids in the expected order.
          type: array
          items:
            type: string
            allOf:
              - $ref: '#/components/schemas/RegexIdValidation'
        interleavedStopIds:
          description: >-
            The stop ids which are not expected and interleaved between the
            order stops.
          type: array
          items:
            type: string
            allOf:
              - $ref: '#/components/schemas/RegexIdValidation'
      required:
        - type
        - expectedSuccessiveStopIds
    OrderViolation:
      type: object
      description: Violation of a order's stops constraint.
      properties:
        type:
          type: string
          enum:
            - order
        expectedOrderedStopIds:
          description: The stop ids in the expected order.
          type: array
          items:
            type: string
            allOf:
              - $ref: '#/components/schemas/RegexIdValidation'
        missedStopIds:
          description: The stop ids missing from the tour.
          type: array
          items:
            type: string
            allOf:
              - $ref: '#/components/schemas/RegexIdValidation'
        badlyOrderedStopIds:
          description: The stop ids badly ordered in the tour.
          type: array
          items:
            type: string
            allOf:
              - $ref: '#/components/schemas/RegexIdValidation'
      required:
        - type
        - expectedOrderedStopIds
    MaxStopSpanViolation:
      type: object
      description: Violation of a order's MaxStopSpan constraint.
      properties:
        type:
          type: string
          enum:
            - maxStopSpan
        orderId:
          description: The order id with the MaxStopSpan constraint violation.
          type: string
          allOf:
            - $ref: '#/components/schemas/RegexIdValidation'
        delay:
          description: The delay that exceeds the MaxStopSpan.
          allOf:
            - $ref: '#/components/schemas/Duration'
      required:
        - type
        - orderId
        - delay
    WorkingTimeWindowViolation:
      type: object
      description: Violation of a resource's TimeWindow constraint.
      properties:
        type:
          type: string
          enum:
            - workingTimeWindow
        delay:
          description: The delay that exceeds the resource's TimeWindow.
          allOf:
            - $ref: '#/components/schemas/Duration'
      required:
        - type
        - delay
    MaxWorkingDurationViolation:
      type: object
      description: Violation of a resource's MaxWorkingDuration constraint.
      properties:
        type:
          type: string
          enum:
            - maxWorkingDuration
        maxWorkingDuration:
          description: The expected maximum working duration.
          allOf:
            - $ref: '#/components/schemas/Duration'
        exceededDuration:
          description: The duration that exceeds the maximum working duration.
          allOf:
            - $ref: '#/components/schemas/Duration'
      required:
        - type
        - maxWorkingDuration
        - exceededDuration
    MaxDistanceInKmViolation:
      type: object
      description: Violation of a resource's MaxDistanceInKm constraint.
      properties:
        type:
          type: string
          enum:
            - maxDistanceInKm
        maxDistanceInKm:
          description: The expected maximum distance, in km.
          type: number
        exceededDistanceInKm:
          description: The distance that exceeds the maximum distance, in km.
          type: number
      required:
        - type
        - maxDistanceInKm
        - exceededDistanceInKm
    MaxInterStopDistanceInKmViolation:
      type: object
      description: Violation of a resource's MaxInterStopDistanceInKm constraint.
      properties:
        type:
          type: string
          enum:
            - maxInterStopDistanceInKm
        wayPointIndex:
          type: integer
          description: The idx of the waypoint the violation applies to.
          example: 0
        maxInterStopDistanceInKm:
          description: The expected maximum inter-stop distance, in km.
          type: number
        exceededDistanceInKm:
          description: The inter-stop distance that exceeds the maximum distance, in km.
          type: number
      required:
        - type
        - maxInterStopDistanceInKm
        - exceededDistanceInKm
    MaxInterStopDurationViolation:
      type: object
      description: Violation of a resource's MaxInterStopDuration constraint.
      properties:
        type:
          type: string
          enum:
            - maxInterStopDuration
        wayPointIndex:
          type: integer
          description: The idx of the waypoint the violation applies to.
          example: 0
        maxInterStopDuration:
          description: The expected maximum inter-stop duration.
          allOf:
            - $ref: '#/components/schemas/Duration'
        exceededDuration:
          description: The inter-stop duration that exceeds the maximum duration.
          allOf:
            - $ref: '#/components/schemas/Duration'
      required:
        - type
        - maxInterStopDuration
        - exceededDuration
    StopIncompatibilityViolation:
      type: object
      description: Violation of a resource's StopIncompatibility constraint.
      properties:
        type:
          type: string
          enum:
            - stopIncompatibility
        name:
          description: >-
            The name of the StopIncompatibility constraint the violation is
            linked to.
          type: string
        incompatibilities:
          description: Lists of stop ids for each incompatible tag.
          type: array
          items:
            type: array
            items:
              allOf:
                - $ref: '#/components/schemas/RegexIdValidation'
              example:
                - stop1
                - stop2
            minItems: 2
            maxItems: 2
        tags:
          $ref: '#/components/schemas/StopTagPair'
      required:
        - type
        - incompatibilities
        - tags
    AtLeastOneConstraintViolation:
      type: object
      description: Violation of a resource's AtLeastOneConstraint constraint.
      properties:
        type:
          type: string
          enum:
            - atLeastOneConstraint
        name:
          description: >-
            The name of the AtLeastOneConstraint constraint the violation is
            linked to.
          type: string
        violatedConstraints:
          description: Lists of sub-constraints violations.
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/TourViolation'
      required:
        - type
        - name
        - violatedConstraints
    MaxStopTagGroupsViolation:
      type: object
      description: Violation of a resource's MaxStopTagGroups constraint.
      properties:
        type:
          type: string
          enum:
            - maxStopTagGroups
        name:
          description: >-
            The name of the MaxStopTagGroups constraint the violation is linked
            to.
          type: string
        exceededNbGroupsByStopTag:
          type: object
          description: The exceeded number of groups by stop tag.
          additionalProperties:
            $ref: '#/components/schemas/ExceededNbGroups'
      required:
        - type
        - exceededNbGroupsByStopTag
    RemovalStrategyViolation:
      type: object
      description: Violation of a resource's RemovalStrategy constraint.
      properties:
        type:
          type: string
          enum:
            - removalStrategy
        name:
          description: >-
            The name of the RemovalStrategy constraint the violation is linked
            to.
          type: string
        removalStrategyType:
          allOf:
            - $ref: '#/components/schemas/RemovalStrategyType'
      required:
        - type
        - removalStrategyType
    Position:
      type: object
      properties:
        lon:
          type: number
          minimum: -180
          maximum: 180
        lat:
          type: number
          minimum: -90
          maximum: 90
      required:
        - lon
        - lat
      example:
        lon: 2.3269331
        lat: 48.8812658
    WayPointStatus:
      type: string
      enum:
        - fixed
        - assigned
        - optimized
      default: fixed
    WaypointViolation:
      description: Semantic violations, can be handled "generically" or specifically.
      oneOf:
        - $ref: '#/components/schemas/BeginViolation'
        - $ref: '#/components/schemas/EndViolation'
        - $ref: '#/components/schemas/SkillsViolation'
        - $ref: '#/components/schemas/ForbiddenAssignmentViolation'
        - $ref: '#/components/schemas/AuthorizedTimeWindowViolation'
        - $ref: '#/components/schemas/CapacityViolation'
        - $ref: '#/components/schemas/AtLeastOneValidCapacityViolation'
        - $ref: '#/components/schemas/MaxInterStopDistanceInKmViolation'
        - $ref: '#/components/schemas/MaxInterStopDurationViolation'
    FromPrevious:
      type: object
      description: >-
        The travel distance and duration from the previous waypoint to the
        current one.
      properties:
        travelDistanceInKm:
          type: number
        travelDuration:
          allOf:
            - $ref: '#/components/schemas/Duration'
      required:
        - travelDistanceInKm
        - travelDuration
      example:
        travelDistanceInKm: 2.3269331
        travelDuration: PT4M
    Properties:
      type: object
      additionalProperties:
        type: string
    StopKind:
      type: string
      enum:
        - pickup
        - delivery
        - acknowledgement
      default: delivery
    CountryCodes:
      type: array
      items:
        $ref: '#/components/schemas/CountryCode'
      example:
        - Switzerland
        - BE
        - ITA
    ShippedHazardousGood:
      type: string
      enum:
        - explosive
        - gas
        - flammable
        - combustible
        - organic
        - poison
        - radioactive
        - corrosive
        - poisonousInhalation
        - harmfulToWater
        - other
    TunnelCategory:
      type: string
      enum:
        - B
        - C
        - D
        - E
      description: Tunnel category restriction for truck routing (ADR tunnel categories)
    ForbiddenAssignment:
      type: object
      description: Forbidden assignment by stop tag and resource tag.
      properties:
        resourceTag:
          type: string
          description: Resource tag.
          example: trailer
          allOf:
            - $ref: '#/components/schemas/RegexIdValidation'
        stopTag:
          type: string
          description: Stop tag.
          example: heavy
          allOf:
            - $ref: '#/components/schemas/RegexIdValidation'
      required:
        - resourceTag
        - stopTag
    TimeWindow:
      type: object
      properties:
        begin:
          $ref: '#/components/schemas/DateTime'
        end:
          $ref: '#/components/schemas/DateTime'
      required:
        - begin
        - end
    StopTagPair:
      type: array
      description: A pair of incompatible stop tags.
      items:
        description: Stop tag.
        allOf:
          - $ref: '#/components/schemas/RegexIdValidation'
      minItems: 2
      maxItems: 2
      uniqueItems: true
      example:
        - goat
        - cabbage
    ExceededNbGroups:
      type: object
      description: >-
        The maximum number of groups and its corresponding exceeding number of
        groups, for a stop tag.
      properties:
        maxAllowed:
          type: integer
          description: Maximum number of groups allowed.
          example: 2
          minimum: 0
        exceededNbGroups:
          type: integer
          description: Number of groups that exceeds the maximum number allowed.
          example: 2
          minimum: 1
      required:
        - maxAllowed
        - exceededNbGroups
    RemovalStrategyType:
      type: string
      enum:
        - lifo
      default: lifo
    CountryCode:
      type: string
      description: A country standard name or Alpha-2 code or Alpha-3 code.
  responses:
    NotAuthenticated:
      description: The caller is not authenticated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EnvelopedErrors'
    Forbidden:
      description: The caller is not allowed to perform this action.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EnvelopedErrors'
    NotFound:
      description: The specified resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EnvelopedErrors'
    InternalServerError:
      description: An internal server error has occurred.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/EnvelopedErrors'
  securitySchemes:
    access_token:
      type: http
      scheme: bearer
      bearerFormat: JWT

````