openapi: 3.0.3
info:
    title: 🅿️ Parking Input Gateway
    description: >-
        <p>💡 Parkings, parking zones, tarifs, measurements.</p>
    version: 1.0.0
    contact:
        name: Golemio Prague Data Plaform
        email: golemio@operatorict.cz
        url: https://golemio.cz
servers:
    - url: https://rabin.golemio.cz/v2
      description: Test (development) server
    - url: https://api.golemio.cz/v2
      description: Main (production) server
    - url: http://localhost:3005
      description: Localhost

tags:
    - name: 🅿️ Parking
      description: ""
paths:
    /koridparkings/config:
        post:
            tags:
                - 🅿️ Parking
            summary: Add config
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: "#/components/schemas/CreateParkingConfig"
            responses:
                204:
                    description: OK
                401:
                    $ref: "#/components/responses/UnauthorizedError"
                422:
                    description: Error while validating input data

    /koridparkings/data:
        post:
            tags:
                - 🅿️ Parking
            summary: Receive and save data
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: "#/components/schemas/PostParkingData"
            responses:
                204:
                    description: OK
                401:
                    $ref: "#/components/responses/UnauthorizedError"
                422:
                    description: Error while validating input data

    /isphkparkings/measurements:
        post:
            tags:
                - 🅿️ Parking
            summary: Receive and save data
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: "#/components/schemas/PostIsphkMeasurments"
            responses:
                204:
                    description: OK
                401:
                    $ref: "#/components/responses/UnauthorizedError"
                422:
                    description: Error while validating input data

components:
    responses:
        UnauthorizedError:
            description: API key is missing or invalid
            headers:
                x-access-token:
                    schema:
                        type: string
    schemas:
        CreateParkingConfig:
            type: object
            required:
                - time
                - geojson
                - tarif
            properties:
                type:
                    type: string
                    example: Feature
                version:
                    type: string
                    example: B.2
                time:
                    type: integer
                    example: 1686129969676
                geojson:
                    type: object
                    required:
                        - type
                        - features
                    properties:
                        type:
                            type: string
                            example: FeatureCollection
                        features:
                            type: array
                            items:
                                type: object
                                required:
                                    - type
                                    - properties
                                    - geometry
                                properties:
                                    type:
                                        type: string
                                        example: Feature
                                    properties:
                                        type: object
                                        required:
                                            - groupid
                                            - title
                                            - total
                                            - tarif
                                        properties:
                                            groupid:
                                                type: number
                                                example: 1
                                            title:
                                                type: string
                                                example: nám. Dr.E.Beneše (Divadlo)
                                            total:
                                                type: number
                                                example: 14
                                            tarif:
                                                type: string
                                                example: A
                                    geometry:
                                        type: object
                                        required:
                                            - type
                                            - coordinates
                                        properties:
                                            type:
                                                type: string
                                                example: Polygon
                                            coordinates:
                                                oneOf:
                                                    - type: array
                                                      items:
                                                          type: array
                                                          items:
                                                              type: array
                                                              items:
                                                                  type: array
                                                                  items:
                                                                      type: number
                                                      example:
                                                          [
                                                              [
                                                                  [
                                                                      [14.50823156003554, 50.10498927328214],
                                                                      [14.505782430390298, 50.1031042405622],
                                                                      [14.509701037821998, 50.1029471511537],
                                                                      [14.50823156003554, 50.10498927328214],
                                                                  ],
                                                              ],
                                                              [
                                                                  [
                                                                      [14.50823156003554, 50.10498927328214],
                                                                      [14.505782430390298, 50.1031042405622],
                                                                      [14.509701037821998, 50.1029471511537],
                                                                      [14.50823156003554, 50.10498927328214],
                                                                  ],
                                                              ],
                                                          ]
                                                    - type: array
                                                      items:
                                                          type: number
                                                      example: [14.441252, 50.109318]
                                                      description: Point
                                                    - type: array
                                                      items:
                                                          type: array
                                                          items:
                                                              type: array
                                                              items:
                                                                  type: number
                                                      example:
                                                          [
                                                              [
                                                                  [14.50823156003554, 50.10498927328214],
                                                                  [14.505782430390298, 50.1031042405622],
                                                                  [14.509701037821998, 50.1029471511537],
                                                                  [14.50823156003554, 50.10498927328214],
                                                              ],
                                                          ]
                                                      description: Polygon
                                                    - type: array
                                                      items:
                                                          type: array
                                                          items:
                                                              type: array
                                                              items:
                                                                  type: array
                                                                  items:
                                                                      type: number
                                                      example:
                                                          [
                                                              [
                                                                  [
                                                                      [14.50823156003554, 50.10498927328214],
                                                                      [14.505782430390298, 50.1031042405622],
                                                                      [14.509701037821998, 50.1029471511537],
                                                                      [14.50823156003554, 50.10498927328214],
                                                                  ],
                                                              ],
                                                              [
                                                                  [
                                                                      [14.50823156003554, 50.10498927328214],
                                                                      [14.505782430390298, 50.1031042405622],
                                                                      [14.509701037821998, 50.1029471511537],
                                                                      [14.50823156003554, 50.10498927328214],
                                                                  ],
                                                              ],
                                                          ]
                                                      description: MultiPolygon
                tarif:
                    type: object
                    required:
                        - lastUpdated
                        - paymentMode
                        - freeOfCharge
                        - chargeBand
                    properties:
                        lastUpdated:
                            type: string
                            example: 2020-10-12T15:19:21+02:00
                        paymentMode:
                            type: array
                            items:
                                type: string
                        paymentAdditionalDescription:
                            type: string
                            example: Parkování Liberec
                        freeOfCharge:
                            type: boolean
                            example: false
                        urlLinkAddress:
                            type: string
                            example: https://parking.liberec.cz/
                        chargeBand:
                            type: array
                            items:
                                type: object
                                required:
                                    - chargeBandName
                                    - chargeCurrency
                                    - charge
                                properties:
                                    chargeBandName:
                                        type: string
                                        example: A
                                    acceptedMeansOfPayment:
                                        type: array
                                        items:
                                            type: string
                                            example: cash
                                    chargeCurrency:
                                        type: string
                                        example: CZK
                                    charge:
                                        type: array
                                        required:
                                            - charge
                                            - chargeOrderIndex
                                            - chargeInterval
                                        items:
                                            type: object
                                            properties:
                                                charge:
                                                    type: number
                                                    example: 20
                                                chargeType:
                                                    type: string
                                                    example: minimum
                                                chargeOrderIndex:
                                                    type: number
                                                    example: 0
                                                chargeInterval:
                                                    type: number
                                                    example: 3600
                                                maxIterationsOfCharge:
                                                    type: number
                                                    example: 1
                                                minIterationsOfCharge:
                                                    type: number
                                                    example: 1
                                                timePeriod:
                                                    type: object
                                                    properties:
                                                        endTimeOfPeriod:
                                                            type: string
                                                            example: Mon-Fri 09:00
                                                        startTimeOfPeriod:
                                                            type: string
                                                            example: Mon-Fri 09:00

        PostParkingData:
            type: object
            required:
                - time
                - data
            properties:
                type:
                    type: string
                    example: parking-groups-data
                version:
                    type: string
                    example: B.0
                time:
                    type: integer
                    example: 1686129969676
                data:
                    type: object
                    additionalProperties:
                        type: object
                        required:
                            - tot
                            - fr
                            - occ
                            - cls
                        properties:
                            tot:
                                type: integer
                                example: 14
                            fr:
                                type: integer
                                example: 2
                            occ:
                                type: integer
                                example: 12
                            cls:
                                type: integer
                                example: 0
                        additionalProperties: false
        PostIsphkMeasurments:
            type: object
            required:
                - time
                - data
            properties:
                type:
                    type: string
                    example: isp
                data:
                    type: array
                    items:
                        type: object
                        required:
                            - id
                            - capacity
                            - free
                            - status
                        properties:
                            id:
                                type: string
                                example: "hk_isp_002"
                            capacity:
                                type: integer
                                example: 284
                            free:
                                type: integer
                                example: 12
                            status:
                                type: string
                                example: "ONLINE"
                        additionalProperties: false
