asyncapi: 3.0.0
info:
    title: Parkings
    version: 1.0.0
    description: Parkings module processes and saves data about parking locations, tariffs and occupancy.
channels:
    parkings.calculateAverageOccupancy:
        address: dataplatform.parkings.calculateAverageOccupancy
        description: Generate average occupancies from data in database.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.generateIptOictEntrancesJobsTask:
        address: dataplatform.parkings.generateIptOictEntrances
        description: Generate jobs to update entrances based on sources table.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.generateIptOictParkingJobs:
        address: dataplatform.parkings.generateIptOictParkingJob
        description: Generate jobs for saveIptOictParkingData based on sources table.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.generateIptOictPaymentJobs:
        address: dataplatform.parkings.generateIptOictPaymentJob
        description: Generate jobs for saveIptOictPaymentsData based on sources in table.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.generateIptOictProhibitionsJobs:
        address: dataplatform.parkings.generateIptOictProhibitionsJobs
        description: Generate jobs for saveIptOictProhibitionsDataTask based on sources table.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.generateIptOictTariffsJobs:
        address: dataplatform.parkings.generateIptOictTariffsJobs
        description: Generate jobs for saveIptOictTariffsData based on sources in table.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.generateIptOictParkingMachinesJobs:
        address: dataplatform.parkings.generateIptOictParkingMachinesJobs
        description: Generate jobs for saveIptOictParkingMachines based on sources in table.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.updateSmart4CityData:
        address: dataplatform.parkings.updateSmart4CityData
        description: Updates smart4city parking, spaces and measurements
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.UpdateSmart4CityInput:
                $ref: "#/components/messages/parkings.UpdateSmart4CityInput"
    parkings.saveBedrichovData:
        address: dataplatform.parkings.saveBedrichovData
        description: Download and save parkings and measurement from Bedřichov
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.generateGreenCenterMeasurementJobs:
        address: dataplatform.parkings.generateGreenCenterMeasurementJobs
        description: Generate tasks for GreenCenter source
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.saveGreenCenterMeasurements:
        address: dataplatform.parkings.saveGreenCenterMeasurements
        description: Download and save measurements from GreenCenter
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/parkings.GreenCenterTaskInputMessage"
    parkings.saveIptOictEntrancesData:
        address: dataplatform.parkings.saveIptOictEntrancesData
        description: Update parking entrances data from IPT cloud source.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.IptOictTaskInputMessage:
                $ref: "#/components/messages/parkings.IptOictTaskInputMessage"
    parkings.saveIptOictParkingData:
        address: dataplatform.parkings.saveIptOictParkingData
        description: Update parkings data from IPT cloud source.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.IptOictTaskInputMessage:
                $ref: "#/components/messages/parkings.IptOictTaskInputMessage"
    parkings.saveIptOictPaymentsData:
        address: dataplatform.parkings.saveIptOictPaymentsData
        description: Update payments data from IPT cloud source.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.IptOictTaskInputMessage:
                $ref: "#/components/messages/parkings.IptOictTaskInputMessage"
    parkings.saveIptOictProhibitionsDataTask:
        address: dataplatform.parkings.saveIptOictProhibitionsDataTask
        description: Update parking prohibitions from IPT cloud source.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.IptOictTaskInputMessage:
                $ref: "#/components/messages/parkings.IptOictTaskInputMessage"
    parkings.saveIptOictTariffsData:
        address: dataplatform.parkings.saveIptOictTariffsData
        description: Update parking tariffs from IPT cloud source.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.IptOictTaskInputMessage:
                $ref: "#/components/messages/parkings.IptOictTaskInputMessage"
    parkings.saveIptOictParkingMachinesData:
        address: dataplatform.parkings.saveIptOictParkingMachinesData
        description: Update parking machines from IPT cloud source.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.IptOictTaskInputMessage:
                $ref: "#/components/messages/parkings.IptOictTaskInputMessage"
    parkings.saveIsphkMeasurements:
        address: dataplatform.parkings.saveIsphkMeasurements
        description: Update incoming (from IG) measurements data from ISPHK (Hradec Králové)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.IsphkMeasurements:
                $ref: "#/components/messages/parkings.IsphkMeasurements"
    parkings.saveKoridConfToDB:
        address: dataplatform.parkings.saveKoridConfToDB
        description: Incoming parkings data from Korid (Liberec)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.KoridConfig:
                $ref: "#/components/messages/parkings.KoridConfig"
    parkings.saveKoridDataToDB:
        address: dataplatform.parkings.saveKoridDataToDB
        description: Incoming measurements data from Korid (Liberec)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.KoridData:
                $ref: "#/components/messages/parkings.KoridData"
    parkings.saveMrParkitData:
        address: dataplatform.parkings.saveMrParkitData
        description: Download and save parkings from Mr.Parkig (Praha)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.saveParkingZonesPrague:
        address: dataplatform.parkings.saveParkingZonesPrague
        description: Update parking zones combined from IPR, TSK and tariffs from TSK (Praha)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.savePmdpMeasurements:
        address: dataplatform.parkings.savePmdpMeasurements
        description: Update occupation measurements from PMDP (Plzeň)
        bindings:
           amqp:
               is: queue
               queue:
                   durable: true
        messages:
            parkings.PmdpTaskTypeInput:
                $ref: "#/components/messages/parkings.PmdpTaskTypeInput"
    parkings.updateAddress:
        address: dataplatform.parkings.updateAddress
        description: Update addresses of parkings, triggered after processing parkings update.
        bindings:
           amqp:
               is: queue
               queue:
                   durable: true
        messages:
            parkgins.UpdateAddressInput:
                $ref: "#/components/messages/parkings.UpdateAddressInput"
    parkings.updateAddressAndName:
        address: dataplatform.parkings.updateAddressAndName
        description: Update addresses and names from photon.
        bindings:
           amqp:
               is: queue
               queue:
                   durable: true
        messages:
            parkings.UpdateAddressAndNameInput:
                $ref: "#/components/messages/parkings.UpdateAddressAndNameInput"
    parkings.updateLocationAddress:
        address: dataplatform.parkings.updateLocationAddress
        description: Update addresses of parking locations, triggered after processing parkings update.
        bindings:
           amqp:
               is: queue
               queue:
                   durable: true
        messages:
            parkings.UpdateAddressInput:
                $ref: "#/components/messages/parkings.UpdateAddressInput"
    parkings.updateAllParkingAdresses:
        address: dataplatform.parkings.updateAllParkingAdresses
        description: Updates batch of addresses of parkings. Runs periodically to continuously update all.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.updateAllParkingsLocationAdresses:
        address: dataplatform.parkings.updateAllParkingsLocationAdresses
        description: Updates batch of addresses of parking locations. Runs periodically to continuously update all.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.updateMissingParkingsAddresses:
        address: dataplatform.parkings.updateMissingParkingsAddresses
        description: Update empty addresses of parkings.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.updateMissingParkingsLocationAddresses:
        address: dataplatform.parkings.updateMissingParkingsLocationAddresses
        description: Update empty addresses of parking locations.
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.updateZtpParkings:
        address: dataplatform.parkings.updateZtpParkings
        description: Update parkings for disabled people (IPR)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    parkings.updateParkingSource:
        address: dataplatform.parkingsources.updateParkingSource
        description: Incoming data about parking sources (manual)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.ParkingSource:
                $ref: "#/components/messages/parkings.ParkingSource"
    parkings.parkomats:
        address: dataplatform.parkomats.refreshDataInDB
        description: Download and save parkomats (Praha), legacy
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            parkings.ParkomatMessage:
                $ref: "#/components/messages/parkings.ParkomatMessage"
    parkings.saveTskOffStreetMeasurements:
        address: dataplatform.parkings.saveTskOffStreetMeasurements
        description: Update occupancy measurements of TSK off-street parkings (P+R, malls, ...)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
operations:
    parkings.calculateAverageOccupancy:
        action: "send"
        channel:
            $ref: "#/channels/parkings.calculateAverageOccupancy"
    parkings.generateIptOictEntrancesJobsTask:
        action: "send"
        channel:
            $ref: "#/channels/parkings.generateIptOictEntrancesJobsTask"
    parkings.generateIptOictParkingJobs:
        action: "send"
        channel:
            $ref: "#/channels/parkings.generateIptOictParkingJobs"
    parkings.generateIptOictPaymentJobs:
        action: "send"
        channel:
            $ref: "#/channels/parkings.generateIptOictPaymentJobs"
    parkings.generateIptOictProhibitionsJobs:
        action: "send"
        channel:
            $ref: "#/channels/parkings.generateIptOictProhibitionsJobs"
    parkings.generateIptOictTariffsJobs:
        action: "send"
        channel:
            $ref: "#/channels/parkings.generateIptOictTariffsJobs"
    parkings.generateIptOictParkingMachinesJobs:
        action: "send"
        channel:
            $ref: "#/channels/parkings.generateIptOictParkingMachinesJobs"
    parkings.updateSmart4CityData:
        action: "send"
        channel:
            $ref: "#/channels/parkings.updateSmart4CityData"
    parkings.saveBedrichovData:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveBedrichovData"
    parkings.generateGreenCenterMeasurementJobs:
        action: "send"
        channel:
            $ref: "#/channels/parkings.generateGreenCenterMeasurementJobs"
    parkings.saveGreenCenterMeasurements:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveGreenCenterMeasurements"
    parkings.saveIptOictEntrancesData:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveIptOictEntrancesData"
    parkings.saveIptOictParkingData:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveIptOictParkingData"
    parkings.saveIptOictPaymentsData:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveIptOictPaymentsData"
    parkings.saveIptOictProhibitionsDataTask:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveIptOictProhibitionsDataTask"
    parkings.saveIptOictTariffsData:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveIptOictTariffsData"
    parkings.saveIptOictParkingMachinesData:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveIptOictParkingMachinesData"
    parkings.saveIsphkMeasurements:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveIsphkMeasurements"
    parkings.saveKoridConfToDB:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveKoridConfToDB"
    parkings.saveKoridDataToDB:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveKoridDataToDB"
    parkings.saveMrParkitData:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveMrParkitData"
    parkings.saveParkingZonesPrague:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveParkingZonesPrague"
    parkings.savePmdpMeasurements:
        action: "send"
        channel:
            $ref: "#/channels/parkings.savePmdpMeasurements"
    parkings.updateAddress:
        action: "send"
        channel:
            $ref: "#/channels/parkings.updateAddress"
    parkings.updateAddressAndName:
        action: "send"
        channel:
            $ref: "#/channels/parkings.updateAddressAndName"
    parkings.updateLocationAddress:
        action: "send"
        channel:
            $ref: "#/channels/parkings.updateLocationAddress"
    parkings.updateZtpParkings:
        action: "send"
        channel:
            $ref: "#/channels/parkings.updateZtpParkings"
    parkings.updateParkingSource:
        action: "send"
        channel:
            $ref: "#/channels/parkings.updateParkingSource"
    parkings.parkomats:
        action: "send"
        channel:
            $ref: "#/channels/parkings.parkomats"
    parkings.saveTskOffStreetMeasurements:
        action: "send"
        channel:
            $ref: "#/channels/parkings.saveTskOffStreetMeasurements"
components:
    messages:
        emptyMessage:
            title: Empty message
        parkings.IptOictTaskInputMessage:
            payload:
                type: object
                properties:
                    source:
                        type: string
                        description: identifikátor zdroje (source)
                        example: "korid"
                additionalProperties: false
        parkings.GreenCenterTaskInputMessage:
            payload:
                type: object
                properties:
                    sourceId:
                        type: string
                        description: identifikátor zdroje (source_id)
                        example: "1219"
                additionalProperties: false
        parkings.IsphkMeasurements:
            payload:
                $ref: "#/components/schemas/parkings.IsphkMeasurementsSchema"
        parkings.KoridConfig:
            payload:
                $ref: "#/components/schemas/parkings.KORIDConfDatasourceJSONSchema"
        parkings.KoridData:
            payload:
                $ref: "#/components/schemas/parkings.KORIDDatasourceJSONSchema"
        parkings.PmdpTaskTypeInput:
            payload:
                type: object
                properties:
                    code:
                        type: string
                        enum:
                            - "pmdp-pmdp_001"
                            - "pmdp-pmdp_002"
                additionalProperties: false
        parkings.UpdateAddressInput:
            payload:
                type: object
                properties:
                    id:
                        type: string
                    "point":
                        type: object
                        properties:
                            type:
                                type: string
                                enum:
                                    - Point
                            coordinates:
                                type: array
                                items:
                                    type: number
                        additionalProperties: false
                additionalProperties: false
        parkings.UpdateAddressAndNameInput:
            payload:
                type: object
                properties:
                    name:
                        type: string
                additionalProperties: false
        parkings.UpdateSmart4CityInput:
            payload:
                type: object
                properties:
                    "type":
                        type: string
                        enum:
                            - data
                            - measurements
                            - all
                additionalProperties: false
        parkings.ParkingSource:
            payload:
                $ref: "#/components/schemas/parkings.ParkingSource"
        parkings.ParkomatMessage:
            payload:
                type: object
                properties:
                    from:
                        type: string
                    to:
                        type: string
                additionalProperties: false
    schemas:
        parkings.KORIDConfDatasourceJSONSchema:
            type: object
            properties:
                type:
                    type: string
                version:
                    type: string
                time:
                    type: integer
                geojson:
                    type: object
                    required:
                        - type
                        - features
                    additionalProperties: true
                    properties:
                        type:
                            type: string
                        features:
                            type: array
                            additionalProperties: true
                            items:
                                type: object
                                required:
                                    - type
                                    - properties
                                    - geometry
                                additionalProperties: false
                                properties:
                                    type:
                                        type: string
                                    properties:
                                        type: object
                                        required:
                                            - groupid
                                            - title
                                            - total
                                            - tarif
                                        additionalProperties: true
                                        properties:
                                            groupid:
                                                type: number
                                            title:
                                                type: string
                                            total:
                                                type: number
                                            tarif:
                                                type: string
                                    geometry:
                                        type: object
                                        required:
                                            - type
                                            - coordinates
                                        additionalProperties: false
                                        properties:
                                            type:
                                                type: string
                                            coordinates:
                                                type: array
                tarif:
                    type: object
                    required:
                        - lastUpdated
                        - paymentMode
                        - freeOfCharge
                        - chargeBand
                    additionalProperties: true
                    properties:
                        lastUpdated:
                            type: string
                        paymentMode:
                            type: array
                            items:
                                type: string
                        paymentAdditionalDescription:
                            type: string
                        freeOfCharge:
                            type: boolean
                        urlLinkAddress:
                            type: string
                        chargeBand:
                            type: array
                            additionalProperties: false
                            items:
                                type: object
                                required:
                                    - chargeBandName
                                    - chargeCurrency
                                    - charge
                                additionalProperties: true
                                properties:
                                    chargeBandName:
                                        type: string
                                    acceptedMeansOfPayment:
                                        type: array
                                        items:
                                            type: string
                                    chargeCurrency:
                                        type: string
                                    charge:
                                        type: array
                                        required:
                                            - charge
                                            - chargeOrderIndex
                                            - chargeInterval
                                        additionalProperties: true
                                        items:
                                            type: object
                                            properties:
                                                charge:
                                                    type: number
                                                chargeType:
                                                    type: string
                                                chargeOrderIndex:
                                                    type: number
                                                chargeInterval:
                                                    type: number
                                                maxIterationsOfCharge:
                                                    type: number
                                                minIterationsOfCharge:
                                                    type: number
                                                startTimeOfPeriod:
                                                    type: string
                                                endTimeOfPeriod:
                                                    type: string
        parkings.KORIDDatasourceJSONSchema:
            type: object
            required:
                - time
                - data
            additionalProperties: true
            properties:
                type:
                    type: string
                version:
                    type: string
                time:
                    type: integer
                data:
                    type: object
                    additionalProperties:
                        type: object
                        required:
                            - tot
                            - fr
                            - occ
                            - cls
                        additionalProperties: false
                        properties:
                            tot:
                                type: integer
                            fr:
                                type: integer
                            occ:
                                type: integer
                            cls:
                                type: integer
        parkings.IsphkMeasurementsSchema:
            type: object
            properties:
                type:
                    type: string
                data:
                    type: array
                    items:
                        type: object
                        properties:
                            id:
                                type: string
                            capacity:
                                type: integer
                            free:
                                type: integer
                            status:
                                type: string
                        required:
                            - id
                            - capacity
                            - free
                            - status
                        additionalProperties: false
            required:
                - data
                - type
            additionalProperties: false
        parkings.ParkingSource:
            type: object
            properties:
                source:
                    type: string
                name:
                    type: string
                    nullable: true
                open_data:
                    type: boolean
                api_v3_allowed:
                    type: boolean
                legacy_api_allowed:
                    type: boolean
                payment:
                    type: object
                    nullable: true
                    properties:
                        method:
                            type: string
                        fee:
                            type: number
                reservation:
                    type: object
                    nullable: true
                    properties:
                        is_required:
                            type: boolean
                        duration:
                            type: integer
                contact:
                    type: object
                    nullable: true
                    properties:
                        email:
                            type: string
                        phone:
                            type: string
                datasource_parking:
                    type: string
                    nullable: true
                datasource_locations:
                    type: string
                    nullable: true
                datasource_payments:
                    type: string
                    nullable: true
                datasource_entrances:
                    type: string
                    nullable: true
                datasource_prohibitions:
                    type: string
                    nullable: true
                datasource_tariffs:
                    type: string
                    nullable: true
