openapi: 3.0.2
info:
  title: API CROW Datastandaard
  version: 0.0.0
servers:
  - url: https://remote.veiligstallenontwikkel.nl/rest/api/v2
paths:
  /auth:
    get:
      tags:
        - authentication
      summary: Get roles and permissions
      operationId: auth
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserPermissions'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '401':
          description: Not authorized
  /organisations:
    get:
      tags:
        - organisations
      summary: All Organisations
      operationId: all_organisations_organisations_get
      parameters:
        - required: false
          schema:
            title: Orderby
            type: string
          name: orderBy
          in: query
        - required: false
          schema:
            allOf:
              - $ref: '#/components/schemas/SortingDirection'
            default: ASC
          name: orderDirection
          in: query
        - required: false
          schema:
            title: Limit
            type: integer
            default: 0
          name: limit
          in: query
        - required: false
          schema:
            title: Offset
            type: integer
            default: 0
          name: offset
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response All Organisations Organisations Get
                type: array
                items:
                  $ref: '#/components/schemas/Organisation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /organisations/{organisation_id}:
    get:
      tags:
        - organisations
      summary: Get Organisation
      operationId: get_organisation_organisations__organisation_id__get
      parameters:
        - required: true
          schema:
            title: Organisation Id
            type: string
          name: organisation_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Organisation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /survey-areas:
    post:
      tags:
        - Survey Areas
      summary: Add Survey Area
      operationId: add_surveyArea_survey_areas_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SurveyArea'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SurveyArea'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
        - Survey Areas
      summary: All Survey Areas
      operationId: all_surveyAreas_survey_areas_get
      parameters:
        - required: false
          schema:
            title: Authority
            type: string
          name: authority
          in: query
        - required: false
          schema:
            title: Local Id
            type: string
          name: localId
          in: query
        - required: false
          schema:
            title: geo polygon
            type: string
          name: geoPolygon
          in: query
        - required: false
          schema:
            title: Valid At
            type: string
            default: current datetime
          name: validAt
          in: query
        - required: false
          schema:
            title: Orderby
            type: string
          name: orderBy
          in: query
        - required: false
          schema:
            allOf:
              - $ref: '#/components/schemas/SortingDirection'
            default: ASC
          name: orderDirection
          in: query
        - required: false
          schema:
            title: Limit
            type: integer
            default: 0
          name: limit
          in: query
        - required: false
          schema:
            title: Offset
            type: integer
            default: 0
          name: offset
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response All Surveyareas Survey Areas Get
                type: array
                items:
                  $ref: '#/components/schemas/SurveyArea'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /survey-areas/{surveyArea_id}:
    get:
      tags:
        - Survey Areas
      summary: Get Survey Area
      operationId: get_surveyArea_survey_areas__surveyArea_id__get
      parameters:
        - required: true
          schema:
            title: Surveyarea Id
            type: string
          name: surveyArea_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SurveyArea'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
        - Survey Areas
      summary: Update Survey Area
      operationId: update_surveyArea_survey_areas__surveyArea_id__put
      parameters:
        - required: true
          schema:
            title: Surveyarea Id
            type: string
          name: surveyArea_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SurveyArea'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SurveyArea'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
        - Survey Areas
      summary: Delete Survey Area
      operationId: delete_survey_area
      parameters:
        - required: true
          schema:
            title: Surveyarea Id
            type: string
          name: surveyArea_id
          in: path
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /survey-areas/{surveyArea_id}/parking-locations:
    get:
      tags:
        - Survey Areas
      summary: Get Parking Locations within a Survey Area
      operationId: get_surveyArea_survey_areas_parking_locations__surveyArea_id__get
      parameters:
        - required: true
          schema:
            title: Surveyarea Id
            type: string
          name: surveyArea_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParkingLocation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /survey-areas/{surveyArea_id}/sections:
    get:
      tags:
        - Survey Areas
      summary: Get Sections within a Survey Area
      operationId: get_surveyArea_survey_areas_sections__surveyArea_id__get
      parameters:
        - required: true
          schema:
            title: Surveyarea Id
            type: string
          name: surveyArea_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Section'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /parking-locations:
    post:
      tags:
        - Parking Locations
      summary: Add Parking Location
      operationId: add_parking_location_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ParkingLocation'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParkingLocation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
        - Parking Locations
      summary: All Parking Locations
      operationId: all_parking-locations_get
      parameters:
        - required: false
          schema:
            title: Authority
            type: string
          name: authority
          in: query
        - required: false
          schema:
            title: Local Id
            type: string
          name: localId
          in: query
        - required: false
          schema:
            title: geo polygon
            type: string
          name: geoPolygon
          in: query
        - required: false
          schema:
            title: Valid At
            type: string
            default: current datetime
          name: validAt
          in: query
        - required: false
          schema:
            title: Orderby
            type: string
          name: orderBy
          in: query
        - required: false
          schema:
            allOf:
              - $ref: '#/components/schemas/SortingDirection'
            default: ASC
          name: orderDirection
          in: query
        - required: false
          schema:
            title: Limit
            type: integer
            default: 0
          name: limit
          in: query
        - required: false
          schema:
            title: Offset
            type: integer
            default: 0
          name: offset
          in: query
        - description: 'List of lat lng coordinates, the last point must equal the first to close the shape: lat1,lng1,lat2,lng2,lat3,lng3,lat1,lng1'
          required: false
          schema:
            title: Geopolygon
            type: string
            default: null
          name: geopolygon
          in: query
        - required: false
          schema:
            allOf:
              - $ref: '#/components/schemas/GeoRelation'
            default: intersects
          name: georelation
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response All Organisations Organisations Get
                type: array
                items:
                  $ref: '#/components/schemas/Organisation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /parking-locations/{parkingLocation_id}:
    get:
      tags:
        - Parking Locations
      summary: Get Parking Location
      operationId: get_parkingLocation_parking_locations__parkingLocation_id__get
      parameters:
        - required: true
          schema:
            title: Parking Location Id
            type: string
          name: parkingLocation_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParkingLocation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
        - Parking Locations
      summary: Update Parking Location
      operationId: update_parkingLocation_parking_locations__parkingLocation_id__put
      parameters:
        - required: true
          schema:
            title: Parking Location Id
            type: string
          name: parkingLocation_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ParkingLocation'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParkingLocation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
        - Parking Locations
      summary: Delete Parking Location
      operationId: delete_parking_location
      parameters:
        - required: true
          schema:
            title: Parking location Id
            type: string
          name: parkingLocation_id
          in: path
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /sections:
    post:
      tags:
        - Sections
      summary: Add Section
      operationId: add_parking-location__sections_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Section'
        required: true
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
        - Sections
      summary: Get Sections
      operationId: get_parking-location__sections_get
      parameters:
        - required: false
          schema:
            title: Authority
            type: string
          name: authority
          in: query
        - required: false
          schema:
            title: Local Id
            type: string
          name: localId
          in: query
        - required: false
          schema:
            title: Valid At
            type: string
            default: current datetime
          name: validAt
          in: query

        - required: false
          schema:
            title: name
            type: string
          name: name
          in: query
        - required: false
          schema:
            title: surveyId
            type: string
          name: surveyId
          in: query
        - required: false
          schema:
            title: level
            type: integer
          name: level
          in: query
        - required: false
          schema:
            title: levelSub
            type: string
          name: levelSub
          in: query
        - required: false
          schema:
            title: layout
            type: string
          name: layout
          in: query
        - required: false
          schema:
            title: parkingLocationLocalId
            type: string
          name: parkingLocationLocalId
          in: query



      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Survey'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /sections/{section_id}:
    get:
      tags:
        - Sections
      summary: Get Section
      operationId: get_sections_section__section_id__get
      parameters:
        - required: true
          schema:
            title: Section Id
            type: string
          name: section_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Section'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
        - Sections
      summary: Update Section
      operationId: put_sections_section__section_id__put
      parameters:
        - required: true
          schema:
            title: Section Id
            type: string
          name: section_id
          in: path
      requestBody:
          content:
            application/json:
              schema:
                title: Array of survey area ids
                type: array
                items:
                  type: string
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
        - Sections
      summary: Delete Section
      operationId: delete_parking-location__section_delete
      parameters:
        - required: true
          schema:
            title: Section Id
            type: string
          name: section_id
          in: path
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /canonical-vehicle-categories:
    post:
      tags:
        - Canonical Vehicles
      summary: Add Canonical Vehicle Category
      operationId: add_canonical-vehicles-category_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CanonicalVehicleCategory'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CanonicalVehicleCategory'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
        - Canonical Vehicles
      summary: All Cannonical Vehicle Categories
      operationId: all_canonical-vehicles-categories_get
      parameters:
        - required: false
          schema:
            title: Orderby
            type: string
          name: orderBy
          in: query
        - required: false
          schema:
            allOf:
              - $ref: '#/components/schemas/SortingDirection'
            default: ASC
          name: orderDirection
          in: query
        - required: false
          schema:
            title: Limit
            type: integer
            default: 0
          name: limit
          in: query
        - required: false
          schema:
            title: Offset
            type: integer
            default: 0
          name: offset
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response All Surveys Surveys Get
                type: array
                items:
                  $ref: '#/components/schemas/CanonicalVehicle'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /canonical-vehicle-categories/{canonical_vehicle_category_id}:
    delete:
      tags:
        - Canonical Vehicles
      summary: Delete Canonical Vehicle Category and all its Canonical Vehicles
      operationId: delete_canonical-vehicle_category
      parameters:
        - required: true
          schema:
            title: Canonical Vehicle Category Id
            type: string
          name: canonical_vehicle_category_id
          in: path
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /canonical-vehicle-categories/{canonical_vehicle_category_id}/canonical-vehicles:
    post:
      tags:
        - Canonical Vehicles
      summary: Add Canonical Vehicle to given Canonical Vehicle Category
      operationId: add_canonical-vehicles_post
      parameters:
        - required: true
          schema:
            title: Canonical Vehicle Category Id
            type: string
          name: canonical_vehicle_category_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CanonicalVehicle'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CanonicalVehicle'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
        - Canonical Vehicles
      summary: All Cannonical Vehicles for given Canonical Vehicle Category
      parameters:
        - required: true
          schema:
            title: Canonical Vehicle Category Id
            type: string
          name: canonical_vehicle_category_id
          in: path
        - required: false
          schema:
            title: Orderby
            type: string
          name: orderBy
          in: query
        - required: false
          schema:
            allOf:
              - $ref: '#/components/schemas/SortingDirection'
            default: ASC
          name: orderDirection
          in: query
        - required: false
          schema:
            title: Limit
            type: integer
            default: 0
          name: limit
          in: query
        - required: false
          schema:
            title: Offset
            type: integer
            default: 0
          name: offset
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response All Canonical Vehicles for Category
                type: array
                items:
                  $ref: '#/components/schemas/CanonicalVehicle'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /canonical-vehicle-categories/{canonical_vehicle_category_id}/canonical-vehicles/{canonical_vehicle_code}:
    get:
      tags:
        - Canonical Vehicles
      summary: All Cannonical Vehicles for given Canonical Vehicle Category
      operationId: canonical-vehicle_get
      parameters:
        - required: true
          schema:
            title: Canonical Vehicle Category Id
            type: string
          name: canonical_vehicle_category_id
          in: path
        - required: true
          schema:
            title: Canonical Vehicle Id
            type: string
          name: canonical_vehicle_code
          in: path
        - required: false
          schema:
            title: Orderby
            type: string
          name: orderBy
          in: query
        - required: false
          schema:
            allOf:
              - $ref: '#/components/schemas/SortingDirection'
            default: ASC
          name: orderDirection
          in: query
        - required: false
          schema:
            title: Limit
            type: integer
            default: 0
          name: limit
          in: query
        - required: false
          schema:
            title: Offset
            type: integer
            default: 0
          name: offset
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response All Surveys Surveys Get
                type: array
                items:
                  $ref: '#/components/schemas/CanonicalVehicle'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    # put:
    #   tags:
    #     - Canonical Vehicles
    #   summary: Update Canonical Vehicle for given Canonical Vehicle Category
    #   operationId: update_canonical-vehicles__canonical-vehicle_id__put
    #   parameters:
    #     - required: true
    #       schema:
    #         title: Canonical Vehicle Category Id
    #         type: string
    #       name: canonical_vehicle_category_id
    #       in: path
    #     - required: true
    #       schema:
    #         title: Canonical Vehicle Id
    #         type: string
    #       name: canonical_vehicle_code
    #       in: path
    #   requestBody:
    #     content:
    #       application/json:
    #         schema:
    #           $ref: '#/components/schemas/CanonicalVehicle'
    #     required: true
    #   responses:
    #     '200':
    #       description: Successful Response
    #       content:
    #         application/json:
    #           schema:
    #             $ref: '#/components/schemas/CanonicalVehicle'
    #     '404':
    #       description: Not found
    #     '422':
    #       description: Validation Error
    #       content:
    #         application/json:
    #           schema:
    #             $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
        - Canonical Vehicles
      summary: Delete Canonical Vehicle
      operationId: delete_canonical-vehicle
      parameters:
        - required: true
          schema:
            title: Canonical Vehicle Category Id
            type: string
          name: canonical_vehicle_category_id
          in: path
        - required: true
          schema:
            title: Canonical Vehicle Id
            type: string
          name: canonical_vehicle_code
          in: path
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /surveys:
    get:
      tags:
        - Surveys
      summary: All Surveys
      operationId: all_surveys_surveys_get
      parameters:
        - required: false
          schema:
            title: Orderby
            type: string
          name: orderBy
          in: query
        - required: false
          schema:
            allOf:
              - $ref: '#/components/schemas/SortingDirection'
            default: ASC
          name: orderDirection
          in: query
        - required: false
          schema:
            title: Limit
            type: integer
            default: 0
          name: limit
          in: query
        - required: false
          schema:
            title: Offset
            type: integer
            default: 0
          name: offset
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response All Surveys Surveys Get
                type: array
                items:
                  $ref: '#/components/schemas/Survey'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
        - Surveys
      summary: Add Survey
      operationId: add_survey_surveys_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Survey'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Survey'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /surveys/{survey_id}:
    put:
      tags:
        - Surveys
      summary: Update Survey
      operationId: update_survey__survey_id__put
      parameters:
        - required: true
          schema:
            title: Survey Id
            type: string
          name: survey_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Survey'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CanonicalVehicle'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
        - Surveys
      summary: Delete Survey
      operationId: delete_survey
      parameters:
        - required: true
          schema:
            title: Survey Id
            type: string
          name: survey_id
          in: path
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /surveys/{survey_id}/survey-areas:
    post:
      tags:
        - Surveys
      summary: Connect Survey areas to survey. Any existing survey areas will be overwritten.
      operationId: add_survey_survey-areas_post
      parameters:
        - required: true
          schema:
            title: Survey Id
            type: string
          name: survey_id
          in: path
      requestBody:
          content:
            application/json:
              schema:
                title: Array of survey area ids
                type: array
                items:
                  type: string
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
        - Surveys
      summary: Add Survey areas to survey. They will be added to the existing survey areas.
      operationId: put_survey_survey-areas
      parameters:
        - required: true
          schema:
            title: Survey Id
            type: string
          name: survey_id
          in: path
      requestBody:
          content:
            application/json:
              schema:
                title: Array of survey area ids
                type: array
                items:
                  type: string
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
        - Surveys
      summary: Get Survey areas for given survey
      operationId: get_survey_surveys__survey_id__survey_areas_get
      parameters:
        - required: true
          schema:
            title: Survey Id
            type: string
          name: survey_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                title: Response All Surveys Surveys Get
                type: array
                items:
                  $ref: '#/components/schemas/Survey'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /surveys/{survey_id}/survey-areas/{survey_area_id}:
    delete:
      tags:
        - Surveys
      summary: Disconnects a Survey area from a survey.
      operationId: delete_survey_survey-areas
      parameters:
        - required: true
          schema:
            title: Survey Id
            type: string
          name: survey_id
          in: path
        - required: true
          schema:
            title: Survey Area Id
            type: string
          name: survey_area_id
          in: path
      responses:
        '200':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /surveys/{survey_id}/parking-locations:
    get:
      tags:
        - Surveys
      summary: Get Parking Locations within a Survey
      operationId: get_surveyArea_survey_parking_locations__survey_id__get
      parameters:
        - required: true
          schema:
            title: Survey Id
            type: string
          name: survey_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ParkingLocation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /surveys/{survey_id}/sections:
    get:
      tags:
        - Surveys
      summary: Get Sections within a Survey
      operationId: get_surveyArea_survey_sections__survey_id__get
      parameters:
        - required: true
          schema:
            title: Survey Id
            type: string
          name: survey_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Section'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /surveys/{survey_id}/observations:
    get:
      tags:
        - Surveys
      summary: Get Observations within a Survey
      operationId: get_survey_observations__survey_id__get
      parameters:
        - required: true
          schema:
            title: Survey Id
            type: string
          name: survey_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Observation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HTTPValidationError'
  /surveys/{survey_id}/combinedobservations:
    get:
      tags:
        - Surveys
      summary: Get CombinedObservations within a Survey
      operationId: get_survey_combinedObservations__survey_id__get
      parameters:
        - required: true
          schema:
            title: Survey Id
            type: string
          name: survey_id
          in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Observation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HTTPValidationError'
  /observations:
    post:
      tags:
        - Observations
      summary: Add Observation
      operationId: add_observation_observations_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Observation'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Observation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /combinedobservations:
    get:
      tags:
        - Observations
      summary: Get Combined Observations
      operationId: add_combinedobservations_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CombinedObservation'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'

components:
  schemas:
    CombinedObservation:
      type: object
      required:
        - featureOfInterest
      properties:
        surveyAreaParent: 
          type: string
          description: id of parent Survey Area
        surveyArea: 
          type: string
          description: id of child Survey Area
        parkingLocation:
          type: string
        section: 
          type: string
        capacityObservation:
            $ref: '#/components/schemas/Observation'
        occupationObservation:
            $ref: '#/components/schemas/Observation'
    Observation:
      type: object
      required:
        - timestampStart
        - contractor
        - timestampEnd
        - survey
        - featureOfInterest
        - measurement
        - observedProperty
      properties:
        id: 
          type: string
        contractor: 
          type: string
        timestampStart: 
          type: string
        timestampEnd: 
          type: string
        survey: 
          type: string
        note:
          $ref: '#/components/schemas/Note'
        observedProperty: 
          type: string
          enum:
              - capacity
              - occupation
        featureOfInterest: 
          type: string
          description: ParkingLocation.id or Section.id
        measurement:
          oneOf:
            - $ref: '#/components/schemas/CapacityMeasurement'
            - $ref: '#/components/schemas/OccupationMeasurement'

    CapacityMeasurement:
      type: object
      required:
        - parkingCapacity
      properties:
        parkingCapacity: 
          type: integer
        capacityPerParkingSpaceTypes:
          type: array
          items:
            $ref: '#/components/schemas/CapacityPerParkingSpaceType'
    
    CapacityPerParkingSpaceType:
      type: object
      properties:
        parkingSpaceOf:
            $ref: '#/components/schemas/ParkingSpaceType'
        numberOfVehicles: 
          type: integer

    ParkingSpaceType:
      title: ParkingSpaceType
      type: object
      properties:
        type:
          type: string
          enum:
            - x
            - r
            - rb
            - b
            - bb
            - o
            - ob
            - k
            - n
            - v
            - a
          description:
            x =  geen voorziening / r = rek / rb =rek (buitenmodel) / b = etagerek-boven / bb  etagerek-boven (buitenmodel) / o =   etagerek-onder / ob = etagerek-onder (buitenmodel) / k = kluis / n = nietjes / v = vak / a = anders
        vehicles:
          type: array
          items:
            $ref: '#/components/schemas/Vehicle'
            
    OccupationMeasurement:
      type: object
      required:
        - totalParked
      properties:
        totalParked: 
          type: integer
        occupiedSpaces:
          type: integer
        vacantSpaces:
          type: integer
        vehicleTypeCounts:
          type: array
          items:
            $ref: '#/components/schemas/VehicleTypeCount'
        basedOffCapacity:
          type: string
          description: id of Observation that vacantSpaces is based on
    VehicleTypeCount:
      type: object
      required:
        - numberOfVehicles
      properties:
        canonicalVehicleCode:
          type: string
        vehicle:
          type: array
          items:
            $ref: '#/components/schemas/Vehicle'
        parkState:
          type: string
          enum:
            - i
            - j
            - k
            - p
            - x
          description:
            i =  In voorziening / j = In voorziening, juist gestald / k = In voorziening, neemt plek in / p = nabij voorziening / x = buiten voorziening
        numberOfVehicles:
          type: integer
      example:
        vehicle:
          type: f
          owner: p
        numberOfVehicles: 6
        parkState: i
    Note:
      type: object
      properties:
        isClosed: 
          type: boolean
        isHoliday: 
          type: boolean
        isEvent: 
          type: boolean
        isUnderConstruction: 
          type: boolean
        remark: 
          type: string
    CanonicalVehicleCategory:
      type: object
      properties:
        id: 
          title: id
          type: string
        authority:
          title: authority
          type: string
    CanonicalVehicle:
      type: object
      properties:
        label: 
          type: string
        description:
          type: string
        code:
          type: string
          description: max length = 4
        json:
          $ref: '#/components/schemas/CanonicalVehicleJson'

    CanonicalVehicleJson:
      type: object
      properties:
        parkState: 
          title: parkState
          type: string
          enum:
              - i
              - p
              - k
              - j
              - x
          description: State of parked (i = In voorziening, j = j  In voorziening, juist gestald, k = In voorziening, neemt plek in, p = nabij voorziening, x = buiten voorziening). More info at https://docs.crow.nl/datastandaard-fietsparkeren/api-fiets/#enum-vehicleparkstate
        vehicles:
          type: array
          items:
            $ref: '#/components/schemas/Vehicle'

    User:
      title: User
      required:
        - username
      type: object
      properties:
        username:
          type: string
        password:
          type: string
    UserPermissions:
      type: object
      properties:
        roles:
          type: array
          items:
            description: role
            type: string
    Organisation:
      required:
        - name
      type: object
      properties:
        id:
          type: string
        name:
          type: string
    GeoRelation:
      enum:
        - intersects
        - within
      type: string
      description: An enumeration.
    SortingDirection:
      enum:
        - ASC
        - DESC
      type: string
      description: An enumeration.
    Survey:
      required:
        - name
        - authority
        - license
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        authority:
          type: string
        contractors:
          type: array
          items:
            type: string
        license:
          type: string
        canonicalVehicleCategory:
          type: string
    SurveyArea:
      required:
        - authority
      type: object
      properties:
        id:
          type: string
        localId:
          type: string
        name:
          type: string
        geoLocation:
          $ref: '#/components/schemas/GeoShape'
        parent:
          type: string
        validFrom:
          type: string
          format: date-time
        validThrough:
          type: string
          format: date-time
        authority:
          type: string
        surveyAreaType:
          type: string
        xtraInfo:
          type: string
    ParkingLocation:
      required:
        - authority
        - name
      type: object
      properties:
        id:
          type: string
        geoLocation:
          $ref: '#/components/schemas/GeoShape'
        validFrom:
          type: string
          format: date-time
        validThrough:
          type: string
          format: date-time
        authority:
          type: string
        name:
          type: string
        localId:
          type: string
        allows:
          $ref: '#/components/schemas/Vehicle'
        features:
          uniqueItems: true
          type: array
          items:
            enum:
              - cameraSurveillance
              - lockerService
              - personnelSupervision
              - electronicAccess
              - indoor
              - surfaceParking
              - building
              - nobuilding
              - guarded
              - unguarded
          default: []
        surveyAreaParentId:
          type: string
          description: Readonly - not to be posted! Only returned in GET /surveys/:id/sections
        surveyAreaParentLocalId:
          type: string
          description: Readonly - not to be posted! Only returned in GET /surveys/:id/sections
        surveyAreaChildId:
          type: string
          description: Readonly - not to be posted! Only returned in GET /surveys/:id/sections
        surveyAreaChildLocalId:
          type: string
          description: Readonly - not to be posted! Only returned in GET /surveys/:id/sections

    Section:
      required:
        - parkingLocation
        - authority
      type: object
      properties:
        id:
          type: string
        geoLocation:
          $ref: '#/components/schemas/GeoShape'
        parkingLocation:
          type: string
        validFrom:
          type: string
          format: date-time
        validThrough:
          type: string
          format: date-time
        authority:
          type: string
        name:
          type: string
        localId:
          type: string
        level:
          type: integer
        levelSub:
          type: string
        parkingSpaceOf:
          type: array
          items:
            $ref: '#/components/schemas/ParkingSpaceType'
        surveyAreaParentId:
          type: string
          description: Readonly - not to be posted! Only returned in GET /surveys/:id/sections
        surveyAreaParentLocalId:
          type: string
          description: Readonly - not to be posted! Only returned in GET /surveys/:id/sections
        surveyAreaChildId:
          type: string
          description: Readonly - not to be posted! Only returned in GET /surveys/:id/sections
        surveyAreaChildLocalId:
          type: string
          description: Readonly - not to be posted! Only returned in GET /surveys/:id/sections
    Vehicle:
      title: Vehicle
      properties:
        type:
          type: string
          enum:
            - f
            - c
            - s
            - b
            - m
            - g
            - a
          description: Vehicle definition (f = fiets, c = bakfiets, s = snorfiets, b = bromfiets, m = motorfiets, g = gehandicaptenvoertuig, a = anders)
        propulsion:
          type: array
          items:
            enum:
              - s
              - e
              - s
              - b
            description: s = human (Spierkracht) / e = electric (Elektrisch  bv e-scooter) / b = combustion (brandstofmotor)        
        appearance:
          type: string
          enum:
            - k
            - r
            - l
            - b
            - f
            - v
            - m
            - d
            - t
            - g
            - x
          description: Verschijningsvorm (k = Kinderfiets / r = Racefiets / l = Ligfiets / b = Bakfiets/Transportfiets / f = Fietskar / v = Vouwfiets / m = Mountainbike / d = Driewieler / t = Tandem / g = Gehandicaptenvoertuig / x = Sterk afwijkend nl. b,f,d,t,g
        state:
          type: array
          items:
            enum:
              - w
              - l
              - z
            description: w = wrak / l = lekke band / z = zonder zadel
        accessories:
          type: array
          items:
            $ref: '#/components/schemas/Accessory'
        owner:
          type: string
          enum:
            - p
            - l
            - h
          description: p = Privéfiets / l = Leasefiets, zoals Swapfiets / h = Huurfiets, zoals OV-fiets
          
    Accessory:
      properties:
        type:
          type: string
          enum:
            - z
            - t
            - b
            - k
            - p
          description: z = kinderzitje / t = fietstas / b = bagagedrager / k = krat/mand / p = Beperkt afwijkend, nl. k,z
        position:
          type: string
          enum:
            - v
            - a
          description: v = voor / a = achter

    GeoShape:
      title: GeoShape
      properties:
        type:
          type: string
          enum:
            - MultiPolygon
            - Polygon
            - Point
          description: Type of shape
        coordinates:
          type: array
          items:
            type: array
            items:
              type: array
              items:
                type: number
      example:
        coordinates:
          - - - - 4.459809327222
                - 51.540021027027
              - - 4.459936684027
                - 51.539941811035
              - - 4.459942559039
                - 51.539950459234
              - - 4.459809327222
                - 51.540021027027
            - - - 4.459809327222
                - 51.540021027027
              - - 4.459936684027
                - 51.539941811035
              - - 4.459942559039
                - 51.539950459234
              - - 4.459809327222
                - 51.540021027027
        type: MultiPolygon
      description: follow format as described in https://www.elastic.co/guide/en/elasticsearch/reference/current/shape.html
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ValidationError:
      title: ValidationError
      required:
        - loc
        - msg
        - type
      type: object
      properties:
        loc:
          title: Location
          type: array
          items:
            type: string
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
