openapi: 3.1.0
info:
  title: Wunder Areas Operations API
  description: This service enables the management of geofenced areas and the logic for enforcing area restrictions.
  version: 1.0.0
  contact:
    name: Wunder Mobility GmbH
    url: 'https://wundermobility.com'
    email: info@wundermobility.com
servers:
  - url: 'https://{environment}.api.gourban.services/v1/{tenant}'
    description: Wunder Areas Operations API
    variables:
      environment:
        default: go
        enum:
          - go
          - go-staging
      tenant:
        default: demo
        description: Tenant identifier of your system. Usually 8 characters.
paths:
  /areas:
    get:
      summary: Retrieve all areas
      tags:
        - Areas
      responses:
        '200':
          description: 'All areas of the tenant or, if branchId is set, all areas of the branch.'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Area'
              examples:
                example-1:
                  value:
                    - uuid: ca3bef66-bba7-45c6-9b59-37b6a747c92c
                      name: string
                      branchId: 712f308d-801e-48bc-b072-9c404734ceb7
                      areaTypeId: 3817eb66-5ce7-4446-ad5f-2bf241e5cdff
                      status: string
                      vehicleTypeIds:
                        - 497f6eca-6276-4993-bfeb-53cbbbba6f08
                      geofence:
                        type: MultiPolygon
                        coordinates:
                          - - - - 15.636866852204463
                                - 48.29979561323316
                              - - 15.68493203775077
                                - 48.29979561323316
                              - - 15.65128640786844
                                - 48.285617903738995
                              - - 15.636866852204463
                                - 48.29979561323316
                      policyNumber: 0
                      tags:
                        - string
                      labels:
                        - string
          headers:
            X-Pagination-TotalPages:
              schema:
                type: number
              description: The number of pages containing results.
            X-Pagination-TotalElements:
              schema:
                type: number
              description: Total number of elements in all pages.
            X-Pagination-Number:
              schema:
                type: number
              description: Number of the current page that is returned.
            X-Pagination-NumberOfElements:
              schema:
                type: number
              description: Number of elements returned in the current page.
            X-Pagination-Size:
              schema:
                type: number
              description: How many elements are returned per page.
            X-Pagination-First:
              schema:
                type: boolean
              description: If the returned page is the first page.
            X-Pagination-Last:
              schema:
                type: string
              description: If the returned page is the last page.
        '401':
          description: Unauthorized - If the request doesn't send a valid auth token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - If the given auth token has no access to the tenant or branch.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: get-area
      description: |-
        Get all areas defined for an tenant.

        Sorted by the time of creation of the area (createdAt) in ascending order by default.
      parameters:
        - $ref: '#/components/parameters/branchId'
        - schema:
            type: boolean
            default: false
          in: query
          name: includeChildBranches
          description: When true, includes areas from child branches of the specified branch. Defaults to false to maintain backward compatibility.
          required: false
        - schema:
            type: number
          in: query
          name: page
          description: The page to be returned with the results
        - schema:
            type: number
          in: query
          name: size
          description: The number of results returned per page
        - schema:
            type: string
          in: query
          name: sort
          description: 'The column that is used for sorting. By default the results are sorted by the time of creation of the area. To get the sort in the descending order, add ",DESC" after the name of the column.'
    post:
      summary: Create a new area
      operationId: post-area
      responses:
        '201':
          description: Successfully created a new area
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Area'
        '400':
          description: Bad Request - Post body malformed
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - If the request doesn't send a valid auth token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - Permission AREA_CREATE missing for the selected branch.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      description: Create a new area.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Area'
      tags:
        - Areas
  '/areas/{id}':
    parameters:
      - schema:
          type: string
          format: uuid
        name: id
        in: path
        required: true
        description: The UUID of the area
    get:
      summary: Get area by id
      tags:
        - Areas
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Area'
              examples: {}
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: get-area-id
      description: Get a specific area.
    delete:
      summary: Delete an area
      operationId: delete-area-id
      responses:
        '200':
          description: OK
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      description: 'Delete an area '
      tags:
        - Areas
    put:
      summary: Update an area
      operationId: put-area-id
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Area'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Area'
      tags:
        - Areas
      description: Update an area.
      parameters:
        - $ref: '#/components/parameters/resetNew'
  /areatypes:
    get:
      summary: Get all area types
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AreaType'
          headers:
            X-Pagination-TotalPages:
              schema:
                type: number
              description: The number of pages containing results.
            X-Pagination-TotalElements:
              schema:
                type: number
              description: Total number of elements in all pages.
            X-Pagination-Number:
              schema:
                type: number
              description: Number of the current page that is returned.
            X-Pagination-NumberOfElements:
              schema:
                type: number
              description: Number of elements returned in the current page.
            X-Pagination-Size:
              schema:
                type: number
              description: How many elements are returned per page.
            X-Pagination-First:
              schema:
                type: boolean
              description: If the returned page is the first page.
            X-Pagination-Last:
              schema:
                type: boolean
              description: If the returned page is the last page.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: |-
            Not Found - Unknown or Invalid Tenant.

            This tenant either doesn't exists or the passed token doesn't have permission to access it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: get-areatype
      description: |-
        Get all area types of a tenant.

        Sorted by the time of creation of the area type (createdAt) in ascending order by default.
      tags:
        - Area Types
      parameters:
        - schema:
            type: number
          in: query
          name: page
          description: The page to be returned with the results
        - schema:
            type: number
          in: query
          name: size
          description: The number of results returned per page
        - schema:
            type: string
          in: query
          name: sort
          description: 'The column that is used for sorting. By default the results are sorted by the time of creation of the area. To get the sort in the descending order, add ",DESC" after the name of the column.'
    post:
      summary: Create new area type
      operationId: post-areatype
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AreaType'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      description: Create a new area type.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AreaType'
        description: ''
      tags:
        - Area Types
  '/areatypes/{id}':
    parameters:
      - schema:
          type: string
          format: uuid
        name: id
        in: path
        required: true
        description: areaTypeId
    get:
      summary: Get area type by id
      tags:
        - Area Types
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AreaType'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      operationId: get-areatype-id
      description: Get a specific area type.
    put:
      summary: Update area type
      operationId: put-areatype-id
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AreaType'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      tags:
        - Area Types
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AreaType'
      description: |-
        Update a area type.

        > Important
        > If the policy-types are changed, also the policies attached to the areas in this area-type will be updated.
      parameters:
        - $ref: '#/components/parameters/resetNew'
    delete:
      summary: Delete area type
      operationId: delete-areatype-id
      responses:
        '204':
          description: No Content - area type has been deleted deleted
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found - area type id not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict - Area type is still in use in at least one area and can't be deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      tags:
        - Area Types
      description: 'Delete a area type. If a area type still has areas attached, those get deleted as well.'
components:
  schemas:
    Area:
      title: Area
      x-stoplight:
        id: r1w5kbj7gmnlp
      type: object
      x-internal: false
      examples:
        - uuid: 3bcc1dc8-f522-4074-9fb9-2bd7672b4708
          name: MDS Area
          branchId: 7c628a07-d557-4cd4-9105-51f9aade2c65
          areaTypeId: b0e30656-8a1a-4eb7-ad3e-bbd8084fb58a
          status: ACTIVE
          vehicleTypeIds:
            - 497f6eca-6276-4993-bfeb-53cbbbba6f08
          geofence:
            type: MultiPolygon
            coordinates:
              - - - - 15.636866852204463
                    - 48.29979561323316
                  - - 15.68493203775077
                    - 48.29979561323316
                  - - 15.65128640786844
                    - 48.285617903738995
                  - - 15.636866852204463
                    - 48.29979561323316
          policies:
            - type: PARKING_RESTRICTION
              vehicle-capacity: null
              vehicles:
                - vehicle-category: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
                  capacity: 250
                - vehicle-category: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
                  capacity: 50
              parking-time:
                - dayOfWeek: MONDAY
                  from: '00:00'
                  to: '23:59'
                - dayOfWeek: TUESDAY
                  from: '00:00'
                  to: '20:00'
          tags:
            - Hello World
          labels:
            - 'MDS:b0e30656-8a1a-4eb7-ad3e-bbd8084fb58a'
      properties:
        uuid:
          type: string
          description: UUID of the area
          format: uuid
          readOnly: true
        name:
          type: string
          description: Display name
        branchId:
          type: string
          format: uuid
        areaTypeId:
          type: string
          description: id of the underlying area type
          format: uuid
        status:
          type: string
        vehicleTypeIds:
          type: array
          format: uuid
          items:
            type: string
            format: uuid
        geofence:
          $ref: '#/components/schemas/GeoJSON-MultiPolygon'
        policies:
          type: array
          description: A list of policy-configurations in line with the areaType's configured policyTypes.
          items:
            $ref: '#/components/schemas/Policy'
        tags:
          type: array
          description: Tags can be set by the client freely.
          items:
            type: string
        labels:
          type: array
          description: Labels are set by the systems and are read only.
          items:
            type: string
            readOnly: true
          readOnly: true
      required:
        - uuid
        - name
        - areaTypeId
        - vehicleTypeIds
        - geofence
    AreaType:
      title: Area Type
      x-stoplight:
        id: f9kpk813fo4vj
      type: object
      examples:
        - uuid: b1844dd7-6adb-4d68-b7d1-c5324fc9601b
          name: Test Area Type
          description: Lorem ipsum dolores....
          style:
            color: '#FF22CA'
            thickness: 2.1
            opacity: 0.6
          tags:
            - string
          labels:
            - string
      properties:
        uuid:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
        description:
          type: string
        style:
          $ref: '#/components/schemas/AreaStyle'
        tags:
          type: array
          description: Tags can be set by the client freely.
          items:
            type: string
        labels:
          type: array
          description: Labels are set by the systems and are read only.
          items:
            type: string
            readOnly: true
          readOnly: true
        policyTypes:
          type: array
          description: These policy types are required on all areas in this area type. Other policy types are not allowed in any area in this type.
          items:
            $ref: '#/components/schemas/PolicyTypes'
        readOnly:
          type: boolean
          description: 'If readOnly is set, no changes to this area type can be made.'
          readOnly: true
      required:
        - uuid
        - name
    AreaStyle:
      title: AreaStyle
      x-stoplight:
        id: 1lpgizviiy1e4
      type: object
      examples:
        - color: '#F2130B'
          thickness: 2
          opacity: 0.7
        - color: '#FF22CA'
          thickness: 1.1
          opacity: 0.6
      properties:
        color:
          type: string
          pattern: '^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$'
          example: '#F2130B'
        thickness:
          type: number
          example: 2
          minimum: 0
          maximum: 100
        opacity:
          type: number
          maximum: 1
          minimum: 0
          example: 0.7
      description: This model describes the styling of an area on the map.
    Policy:
      oneOf:
        - $ref: '#/components/schemas/Capacity-Policy'
        - $ref: '#/components/schemas/NoEndRentalPolicy'
        - $ref: '#/components/schemas/SpeedLimit-Policy'
        - $ref: '#/components/schemas/NoParkingPolicy'
        - $ref: '#/components/schemas/AllowEndRentalPolicy'
        - $ref: '#/components/schemas/NoticeAreaPolicy'
    PolicyTypes:
      type: string
      title: Policy Types
      x-stoplight:
        id: bg4gxl9jt6vg6
      x-internal: false
      description: Identifiers of the different kinds of policies supported
      x-tags:
        - Policies
      enum:
        - END_RENTAL_CAPACITY_POLICY
        - SPEED_LIMIT_POLICY
        - NO_PARKING_POLICY
        - NO_END_RENTAL_POLICY
        - ALLOW_END_RENTAL_POLICY
        - NOTICE_AREA_POLICY
    Capacity-Policy:
      type: object
      x-examples:
        example-1:
          vehicle-capacity: null
          vehicles:
            - vehicle-category: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
              capacity: 250
            - vehicle-category: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
              capacity: 50
          parking-time:
            - dayOfWeek: MONDAY
              from: '00:00'
              to: '23:59'
            - dayOfWeek: TUESDAY
              from: '00:00'
              to: '20:00'
      examples:
        - type: END_RENTAL_CAPACITY_POLICY
          overallCapacity: 30
          applicableStates:
            - PARKING
            - AVAILABLE
          capacityByCategories:
            - vehicleCategoryIds:
                - bike-id
                - scooter-id
              capacity: 20
            - vehicleCategoryIds:
                - car-id
              capacity: 40
        - type: END_RENTAL_CAPACITY_POLICY
          status: ACTIVE
          overallCapacity: null
          applicableStates:
            - AVAILABLE
          capacityByCategories:
            - vehicleCategoryIds:
                - string
              capacity: 0
          schedule:
            - dayOfWeek: MONDAY
              from: '14:15'
              to: '16:15'
      title: End Rental Capacity Policy
      description: |-
        This policy limits the amount of vehicles allowed in one (or more) specific states in an area.

        Either `overallCapacity` has to be set or at least one `capacityByCategory` element has to be set. Otherwise the policy will always return a succesfull validation for each vehicle.

        If both are set the stricter limit counts. 

        If the `overallCapacity` is 0 the area turnes into a restricted area for the given `applicableStates`.

        ---
        #### Example 1:
         ```json
        {
          "type": "END_RENTAL_CAPACITY_POLICY",
          "overallCapacity": 30,
          "applicableStates": [
            "PARKING",
            "AVAILABLE"
          ],
          "capacityByCategories": [
            {
              "vehicleCategoryIds": [
                "bike-id",
                "scooter-id"
              ],
              "capacity": 20
            },
            {
              "vehicleCategoryIds": [
                "car-id"
              ],
              "capacity": 40
            }
          ]
        }
        ```
        This policy never allows more than 30 vehicles with the state `PARKING` or `AVAILABLE` in the area, even though there exists a policy for a specific *car-id* that has a higher limit set in `capacityByCategories`. 
         
        If there are already 30 cars with those states in the area, no bikes or scooter are allowed. Vehicle 
        categories who's *vehicleCategoryId* share a a `capacityByCategories` entry share the limit. 

        As a result, this policy only allowes a total of 20 vehicles between the category `bike-id` and `scooter-id` combined.

        There is no limit as how often a `vehicleCategoryId` can occur and in which combination it can be used. Each instance will be checked and each of them must pass for the check to pass.

        ### Schedule
        > Schedules are an early alpha feature and not yet fully functional.
        You can add the schedule for the policy. E.g. if you want this policy to be only active Monday and Friday from 9 to 5, you can add it like in the following example:

        #### Example 2:
         ```json
        {
          ...
          "schedule": [
            {
              "dayOfWeek": "MONDAY",
              "from": "09:00",
              "to": "17:00"
            },
            {
              "dayOfWeek": "FRIDAY",
              "from": "9:00",
              "to": "17:00"
            }
          ],
          ...
        }
        ```
        If you have multiple timeslots in one day you can simply add them to the list, e.g a restriction thats only active MONDAY from 9-11 and 12-14 o'clock:

        #### Example 3:
         ```json
        {
          ...
          "schedule": [
            {
              "dayOfWeek": "MONDAY",
              "from": "09:00",
              "to": "11:00"
            },
            {
              "dayOfWeek": "MONDAY",
              "from": "12:00",
              "to": "14:00"
            }
          ],
          ...
        }
        ```

        ---
      x-tags:
        - Policies
      properties:
        type:
          type: string
          enum:
            - CAPACITY_POLICY
          description: This value must always be CAPACITY_POLICY.
        overallCapacity:
          type:
            - 'null'
            - integer
          description: Total capacity for all vehicles. Ignored if null.
          minimum: 0
        applicableStates:
          type: array
          description: 'This policy only applies to vehicles in the states given. If none is given, the policy will apply to all states.'
          items:
            $ref: '#/components/schemas/VehicleState'
        capacityByCategories:
          type: array
          description: Setup restrictions by specific vehicle categorys.
          minItems: 0
          items:
            type: object
            properties:
              vehicleCategoryIds:
                type: array
                minItems: 1
                description: A list of all vehicle categories the capacity applies to.
                items:
                  type: string
              capacity:
                type: integer
                description: Capacity for that specific vehicle category.
                minimum: 0
            required:
              - vehicleCategoryIds
              - capacity
        schedule:
          type: array
          description: Shedule for the policy. If timesets are set the policy is only active during these timeframes. If schedule is null or an empty list the policy is active at all times.
          items:
            type: object
            properties:
              dayOfWeek:
                type: string
                enum:
                  - MONDAY
                  - THUESDAY
                  - WEDNESDAY
                  - TUESDAY
                  - FRIDAY
                  - SATURDAY
                  - SUNDAY
              from:
                type: string
                format: time
                description: 'Time in 24h format: HH:mm or HH:mm:ss'
              to:
                type: string
                format: time
                description: 'Time in 24h format: HH:mm or HH:mm:ss'
            required:
              - dayOfWeek
              - from
              - to
        '':
          type: string
      required:
        - type
        - schedule
    SpeedLimit-Policy:
      type: object
      examples:
        - type: SPEED_LIMIT_POLICY
          speedLimit: 25
          speedLimitOverrides:
            - vehicleCategoryIds:
                - bike-id
                - scooter-id
              speedLimit: 20
            - vehicleCategoryIds:
                - car-id
              capacity: 45
        - type: SPEED_LIMIT_POLICY
          speedLimit: 15
      title: Speed Limit Policy
      description: |-
        This policy limits the maximum speed of vehicles in an area.

        Either `speedLimit` has to be set or at least one `speedLimitOverrides` element has to be set. Otherwise the policy will not have any effect.

        If both are set, any available `speedLimitOverrides` for that vehicle-category will overwrite the `speedLimit` of the policy. 


        ---
        #### Example 1:
         ```json
        {
          "type": "SPEED_LIMIT_POLICY",
          "speedLimit": 25.0,
          "speedLimitOverrides": [
            {
              "vehicleCategoryIds": [
                "bike-id",
                "scooter-id"
              ],
              "speedLimit": 20.0
            },
            {
              "vehicleCategoryIds": [
                "car-id"
              ],
              "capacity": 45.0
            }
          ]
        }
        ```
        This policy sets the max speed for every vehicle to *25km/h*. If the vehicle has the category `bike-id` or `scooter-id` it will be set to *20km/h*. If the vehicle is a `car-id`, the max speed will be set to *45km/h*.


        Every vehicle category **can only be used once** in a speed-limit-policy (Can only appear in one speedLimitOverrides object).

        ---
      x-tags:
        - Policies
      x-stoplight:
        id: 0a7d0aa7adb78
      properties:
        type:
          type: string
          enum:
            - SPEED_LIMIT_POLICY
          description: This value must always be CAPACITY_POLICY.
        speedLimit:
          type:
            - number
            - 'null'
          description: Max allowed speed in km/h. Ignored if null.
          minimum: 1
          example: 25
        speedLimitOverrides:
          type: array
          description: Setup restrictions by specific vehicle categorys.
          minItems: 0
          items:
            type: object
            properties:
              vehicleCategoryIds:
                type: array
                minItems: 1
                description: A list of all vehicle categories the speed limit override applies to.
                items:
                  type: string
              speedLimit:
                type: number
                description: Capacity for that specific vehicle category.
                minimum: 1
                example: 20
            required:
              - vehicleCategoryIds
              - speedLimit
      required:
        - type
    NoEndRentalPolicy:
      examples:
        - type: NO_END_RENTAL_POLICY
      title: No End Rental Policy
      description: |-
        This policy marks an area as restricted. Meaning, ending a rental is not allowed there.

        This simple policy has no configuration values. If present, it is active for that area.
      type: object
      x-tags:
        - Policies
      x-stoplight:
        id: 79efee0dcb505
      properties:
        type:
          type: string
          enum:
            - NO_END_RENTAL_POLICY
    NoParkingPolicy:
      examples:
        - type: NO_PARKING_POLICY
      title: No Parking Policy
      description: |-
        This policy marks an area as "noParking". Meaning, no parking is allowed there.

        This simple policy has no configuration values. If present, it is active for that area.
      type: object
      x-tags:
        - Policies
      x-stoplight:
        id: 09e9bf1324a39
      properties:
        type:
          type: string
          enum:
            - NO_PARKING_POLICY
    NoticeAreaPolicy:
      examples:
        - type: NOTICE_AREA_POLICY
      title: Notice Area Policy
      description: This policy has no rental or ride-flow implications. It is simply there to give a notice to a user.
      type: object
      x-tags:
        - Policies
      x-stoplight:
        id: 461b6ef810be5
      properties:
        type:
          type: string
          enum:
            - NOTICE_AREA_POLICY
    AllowEndRentalPolicy:
      examples:
        - type: ALLOW_END_RENTAL_POLICY
      title: Allow End Rental Policy
      description: This policy allows the ending of a rental in the area.
      type: object
      x-tags:
        - Policies
      x-stoplight:
        id: 9e3921421080a
      properties:
        type:
          type: string
          enum:
            - ALLOW_END_RENTAL_POLICY
    Vehicle:
      title: Vehicle
      x-stoplight:
        id: 4zcunsidnee3y
      type: object
      description: 'A vehicle representation. TODO: Finalize'
      examples:
        - vehicleId: c406adf4-e700-4483-ad7a-e7447a2941cb
          vehicleCategoryId: ad3f219d-3368-4a98-8014-5d83b5f3cd04
          vehicleRentalState: AVAILABLE
          position:
            type: Point
            coordinates:
              - 16.368993736215998
              - 48.20269351468829
      properties:
        vehicleId:
          type: string
          format: uuid
        vehicleCategoryId:
          type: string
          format: uuid
        vehicleRentalState:
          type: string
          description: 'Status of the vehicle. '
          enum:
            - AVAILABLE
            - PARKING
            - DRIVING
            - RESERVATION
            - DELIVERED
        position:
          $ref: '#/components/schemas/GeoJSON-Point'
      required:
        - vehicleId
        - vehicleCategoryId
        - position
    VehicleState:
      type: string
      title: VehicleState
      x-stoplight:
        id: rygdb7f7r6wfu
      enum:
        - AVAILABLE
        - PARKING
        - DRIVING
        - RESERVATION
        - NON_OPERATIONAL
    GeoJSON-Point:
      type: object
      x-examples:
        example-1:
          type: MultiPolygon
          coordinates:
            - - - - 15.636866852204463
                  - 48.29979561323316
                - - 15.68493203775077
                  - 48.29979561323316
                - - 15.65128640786844
                  - 48.285617903738995
                - - 15.636866852204463
                  - 48.29979561323316
      examples:
        - type: Point
          coordinates:
            - 16.368993736215998
            - 48.20269351468829
      title: GeoJSON Point
      properties:
        type:
          type: string
          enum:
            - Point
        coordinates:
          $ref: '#/components/schemas/Coordinates'
      description: Describes the Lat and Long of a geospartial point.
    GeoJSON-MultiPolygon:
      type: object
      x-examples:
        example-1:
          type: MultiPolygon
          coordinates:
            - - - - 15.636866852204463
                  - 48.29979561323316
                - - 15.68493203775077
                  - 48.29979561323316
                - - 15.65128640786844
                  - 48.285617903738995
                - - 15.636866852204463
                  - 48.29979561323316
      examples:
        - type: MultiPolygon
          coordinates:
            - - - - 15.636866852204463
                  - 48.29979561323316
                - - 15.68493203775077
                  - 48.29979561323316
                - - 15.65128640786844
                  - 48.285617903738995
                - - 15.636866852204463
                  - 48.29979561323316
      title: GeoJSON Multi Polygon
      properties:
        type:
          type: string
          enum:
            - MultiPolygon
        coordinates:
          type: array
          items:
            type: array
            items:
              $ref: '#/components/schemas/Coordinates'
      description: Describes a geospartial multi polygon created by lists of coordinates.
    Coordinates:
      type: array
      title: Coordinates
      x-stoplight:
        id: qdtufokah0nlo
      minItems: 2
      maxItems: 2
      items:
        type: number
        minimum: -180
        maximum: 180
      description: 'WGS84 representation of latitude longitude. First array value is latitude, second is longitude.'
      examples:
        - - 23.48712
          - 12.75912
    Error:
      type: object
      x-examples:
        example-1:
          traceId: 4e30f7340b3fb631
          errorCode: '912.4'
          message: Area geometry is not valid
      description: Error response of the API
      title: Error
      examples:
        - traceId: 4e30f7340b3fb631
          errorCode: '912.4'
          errorMessage: Area geometry is not valid
      properties:
        errorCode:
          type: string
          description: Error identifier from the service.
        errorMessage:
          type: string
          description: Error message for the user.
        traceId:
          type: string
          description: Trace id for request tracking.
      required:
        - errorCode
        - errorMessage
        - traceId
    Status:
      type: string
      title: Status
      x-stoplight:
        id: auk785f45an1x
      enum:
        - ACTIVE
        - INACTIVE
  requestBodies: {}
  responses: {}
  parameters:
    branchId:
      name: branch
      in: query
      schema:
        type: string
        format: uuid
      description: Branch Id for the query'ed objects
    tenant:
      name: tenant
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: The ID of the active tenant
    lat:
      name: lat
      in: query
      required: true
      schema:
        type: number
        minimum: -90
        maximum: 90
        example: 48.192863
      description: Latitude of the point.
    long:
      name: long
      in: query
      required: true
      schema:
        type: number
        minimum: -180
        maximum: 180
        example: 16.359970
      description: Longitude of the point.
    resetNew:
      name: useDefaults
      in: query
      schema:
        type: boolean
        default: false
      description: 'When changing the areaType, if a newly required policy already has a saved but inactive configuration, this variable controls if that configuration should be reused (`false`) or if the configuration should be reset to default values (`true`).'
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
security:
  - jwtAuth: []
tags:
  - name: Area Types
    description: Area Types
  - name: Areas
    description: Areas
  - name: Policies
    description: Policies
