asyncapi: 3.0.0
info:
    title: Energetics
    version: 1.0.0
    description: Energetics
channels:
    energetics.fetchAccessConfiguration:
        address: dataplatform.energeticsoict.fetchAccessConfiguration
        description: updates access configuration table in the databse from blob storage datasource
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    energetics.fetchConsumption:
        address: dataplatform.energeticsoict.fetchConsumption
        description: updates consumption in database table consumption_energy_consumption
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            fetchConsumptionMessage:
                $ref: "#/components/messages/energetics.fetchConsumptionMessage"
    energetics.fetchData:
        address: dataplatform.energeticsoict.fetchData
        description: create messages for queue fetchConsumption based on input message
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            targetDays:
                $ref: "#/components/messages/energetics.fetchDataMessage"
    energetics.fetchVpalacXDaysData:
        address: dataplatform.energetics.fetchVpalacXDaysData
        description: updates vpalac data (measuremenets, measuringEquipment, meterTypes, typeMeasuringEquipment, unitData) in database
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            targetDays:
                $ref: "#/components/messages/energetics.fetchDataMessage"
    energetics.fetchVpalacXHoursData:
        address: dataplatform.energetics.fetchVpalacXHoursData
        description: updates vpalac data (measuremenets, measuringEquipment, meterTypes, typeMeasuringEquipment, unitData) in database
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            targetDays:
                $ref: "#/components/messages/energetics.fetchXHoursDataMessage"
    energetics.fetchMeasurementOptionsStaticData:
        address: dataplatform.energeticscommodity.fetchMeasurementOptionsStaticData
        description: updates meter settings in database table commodity_static_meter_settings
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            empty:
                $ref: "#/components/messages/emptyMessage"
    energetics.fetchMeasurementsFromEEProviders:
        address: dataplatform.energeticscommodity.fetchMeasurementsFromEEProviders
        description: based on input message it generates messages for queue fetchPpasEEMeasurements
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            targetDays:
                $ref: "#/components/messages/energetics.fetchDataMessage"
    energetics.fetchPpasEEMeasurements:
        address: dataplatform.energeticscommodity.fetchPpasEEMeasurements
        description: downloads measurements data from Pražská Plynárenská
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            targetDays:
                $ref: "#/components/messages/energetics.fetchDataMessage"
    energetics.fetchMeasurementsFromProviders:
        address: dataplatform.energeticscommodity.fetchMeasurementsFromProviders
        description: create messages for other queues to download measurements data from Veolia, Pražská Plynárenská and Pre electro
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            targetDays:
                $ref: "#/components/messages/energetics.fetchDataMessage"
    energetics.fetchPpasMeasurements:
        address: dataplatform.energeticscommodity.fetchPpasMeasurements
        description: downloads measurements data from Pražská Plynárenská
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            targetDays:
                $ref: "#/components/messages/energetics.PpasMeasurementsMessages"
    energetics.fetchPreElectroMeasurementsTask:
        address: dataplatform.energeticscommodity.fetchPreElectroMeasurementsTask
        description: downloads measurements data from PRE
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            targetDays:
                $ref: "#/components/messages/energetics.fetchConsumptionMessage"
    energetics.processPreEanMeasurementsTask:
        address: dataplatform.energeticscommodity.processPreEanMeasurementsTask
        description: process incoming measurements from PRE
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            preEanMeasurementMessage:
                $ref: "#/components/messages/energetics.preEanMeasurementMessage"
    energetics.savePtasMeasurements:
        address: dataplatform.energeticscommodity.savePtasMeasurements
        description: downloads measurements data from Pražská Teplárenská
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            targetDays:
                $ref: "#/components/messages/energetics.PtasMeasurementsMessages"
    energetics.fetchVeoliaMeasurements:
        address: dataplatform.energeticscommodity.fetchVeoliaMeasurements
        description: downloads measurements data from Veolia
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            targetDays:
                $ref: "#/components/messages/energetics.VeoliaMeasurementsMessages"
    energetics.processEnoLookup:
        address: dataplatform.enapoenergetics.processEnoLookup
        description: downloads lookup data (structure types, organizations, managers, EJ) from ENO SOAP/WSDL API and stores in database tables (eno_struktura_typ_lookup, eno_organizace_lookup, eno_spravce_lookup, eno_ej_lookup)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            enoLookupMessage:
                $ref: "#/components/messages/energetics.EnoLookupMessage"
    energetics.processEnoBuildings:
        address: dataplatform.enapoenergetics.processEnoBuildings
        description: downloads building data from ENO SOAP/WSDL API including buildings, properties, addresses, and locations. Supports full and incremental synchronization using daysBack parameter. Stores data in database tables (eno_budova, eno_majetek, eno_adresa, eno_umisteni, eno_vyrazene_gid)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            enoBuildingMessage:
                $ref: "#/components/messages/energetics.EnoBuildingMessage"
    energetics.processEnoStructures:
        address: dataplatform.enapoenergetics.processEnoStructures
        description: downloads structure (stavba) data from ENO SOAP/WSDL API including structures, properties, addresses, and locations. Supports full and incremental synchronization using daysBack parameter. After successful processing, triggers geometry download. Stores data in database tables (eno_stavba, eno_majetek, eno_adresa, eno_umisteni, eno_vyrazene_gid)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            enoStructureMessage:
                $ref: "#/components/messages/energetics.EnoBuildingMessage"
    energetics.processEnoGeometry:
        address: dataplatform.enapoenergetics.processEnoGeometry
        description: downloads geometry (polygons) for buildings and structures from ENO SOAP/WSDL API. Automatically triggered after building or structure synchronization. Stores data in database table (eno_geometrie)
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            enoGeometryMessage:
                $ref: "#/components/messages/energetics.EnoGeometryMessage"
    energetics.processEnoOrganizationSync:
        address: dataplatform.enapoenergetics.processEnoOrganizationSync
        description: fans out a buildings + structures sync across every organizationId configured for every ENO source (stat, mhmp, mc), so one trigger message covers MHMP, stát and all 57 městská část organizations instead of one message per organization
        bindings:
            amqp:
                is: queue
                queue:
                    durable: true
        messages:
            enoOrganizationSyncMessage:
                $ref: "#/components/messages/energetics.EnoOrganizationSyncMessage"
operations:
    energetics.fetchAccessConfiguration:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchAccessConfiguration"
    energetics.fetchConsumption:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchConsumption"
    energetics.fetchData:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchData"
    energetics.fetchVpalacXDaysData:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchVpalacXDaysData"
    energetics.fetchVpalacXHoursData:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchVpalacXHoursData"
    energetics.fetchMeasurementOptionsStaticData:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchMeasurementOptionsStaticData"
    energetics.fetchMeasurementsFromEEProviders:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchMeasurementsFromEEProviders"
    energetics.fetchPpasEEMeasurements:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchPpasEEMeasurements"
    energetics.fetchMeasurementsFromProviders:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchMeasurementsFromProviders"
    energetics.fetchPpasMeasurements:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchPpasMeasurements"
    energetics.fetchPreElectroMeasurementsTask:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchPreElectroMeasurementsTask"
    energetics.savePtasMeasurements:
        action: "send"
        channel:
            $ref: "#/channels/energetics.savePtasMeasurements"
    energetics.fetchVeoliaMeasurements:
        action: "send"
        channel:
            $ref: "#/channels/energetics.fetchVeoliaMeasurements"
    energetics.preEanMeasurementMessage:
        action: "send"
        channel:
            $ref: "#/channels/energetics.processPreEanMeasurementsTask"
    energetics.processEnoLookup:
        action: "send"
        channel:
            $ref: "#/channels/energetics.processEnoLookup"
    energetics.processEnoBuildings:
        action: "send"
        channel:
            $ref: "#/channels/energetics.processEnoBuildings"
    energetics.processEnoStructures:
        action: "send"
        channel:
            $ref: "#/channels/energetics.processEnoStructures"
    energetics.processEnoGeometry:
        action: "send"
        channel:
            $ref: "#/channels/energetics.processEnoGeometry"
    energetics.processEnoOrganizationSync:
        action: "send"
        channel:
            $ref: "#/channels/energetics.processEnoOrganizationSync"
components:
    messages:
        emptyMessage:
            title: Empty message
        energetics.fetchConsumptionMessage:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.IFetchConsumptionInput"
                additionalProperties: false
        energetics.fetchDataMessage:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.IFetchDataInput"
                additionalProperties: false
        energetics.fetchXHoursDataMessage:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.IFetchXHoursDataInput"
                additionalProperties: false
        energetics.PpasMeasurementsMessages:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.IPpasMeasurementsParams"
                additionalProperties: false
        energetics.PtasMeasurementsMessages:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.IPtasWebScrapingInput"
                additionalProperties: false
        energetics.VeoliaMeasurementsMessages:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.IVeoliaMeasurementsMessages"
                additionalProperties: false
        energetics.preEanMeasurementMessage:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.preEanMeasurementMessage"
                additionalProperties: false
        energetics.EnoLookupMessage:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.IEnoLookupTaskInput"
                additionalProperties: false
        energetics.EnoBuildingMessage:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.IEnoBuildingTaskInput"
                additionalProperties: false
        energetics.EnoGeometryMessage:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.IEnoGeometryTaskInput"
                additionalProperties: false
        energetics.EnoOrganizationSyncMessage:
            payload:
                type: object
                $ref: "#/components/schemas/energetics.IEnoOrganizationSyncTaskInput"
                additionalProperties: false
    schemas:
        energetics.IFetchConsumptionInput:
            type: object
            properties:
                dateFrom:
                    type: string
                    format: date
                    description: The date from which the consumption is to be fetched
                dateTo:
                    type: string
                    format: date
                    description: The date to which the consumption is to be fetched
            additionalProperties: false
        energetics.IFetchDataInput:
            type: object
            properties:
                targetDays:
                    type: number
                    description: The number of days for which the consumption is to be fetched
            additionalProperties: false
        energetics.IFetchXHoursDataInput:
            type: object
            properties:
                targetHours:
                    type: number
                    description: The number of hours for which the consumption is to be fetched
            additionalProperties: false
        energetics.IPpasMeasurementsParams:
            type: object
            properties:
                dateFrom:
                    type: string
                    format: date
                    description: The date from which the consumption is to be fetched
                dateTo:
                    type: string
                    format: date
                    description: The date to which the consumption is to be fetched
                providerType:
                    type: string
                    description: The type of provider from which the measurements are to be fetched
                    enum:
                        - "ppas_ave_api_v"
                        - "ppas_ave_api_m"
                        - "ppas_ave_api_a"
                        - "ppas_ave_api_c"
                        - "ppas_ave_api_mo"
        energetics.IPtasWebScrapingInput:
            type: object
            properties:
                placeId:
                    type: string
                    description: The place id for which the measurements are to be fetched
                measurements:
                    type: array
                    items:
                        type: object
                        properties:
                            "Datum odečtu":
                                type: string
                            "Čas odečtu":
                                type: string
                            "Výrobní číslo":
                                type: string
                            "Druh registru":
                                type: string
                            "Odečet":
                                type: string
                            "MJ odečtu":
                                type: string
                            "MJ zúčt.":
                                type: string
                            "OM závislé":
                                type: string
                            "Typ odečtu":
                                type: string
                            "Status odečtu":
                                type: string
        energetics.IVeoliaMeasurementsMessages:
            type: object
            properties:
                dateFrom:
                    type: string
                    format: date
                    description: The date from which the consumption is to be fetched
                dateTo:
                    type: string
                    format: date
                    description: The date to which the consumption is to be fetched
                providerType:
                    type: string
                    description: The type of provider from which the measurements are to be fetched
                    enum:
                        - "cem_api_veolia_water"
                        - "cem_api_veolia_electro"
        energetics.preEanMeasurementMessage:
            type: object
            properties:
                ean:
                    type: string
                    description: EAN code of measuring device
                T1_Wh_raw_data:
                    type: array
                    description: Array of timestamps and values of measurements
        energetics.IEnoLookupTaskInput:
            type: object
            required:
                - type
            properties:
                type:
                    type: string
                    description: Type of lookup data to fetch from ENO system
                    enum:
                        - "getDruhStavba"
                        - "getOrganizace"
                        - "getSpravce"
                        - "getEvidencniJednotky"
                    examples:
                        - "getDruhStavba"
                        - "getOrganizace"
                        - "getSpravce"
                        - "getEvidencniJednotky"
            additionalProperties: false
        energetics.IEnoBuildingTaskInput:
            type: object
            required:
                - type
                - source
                - organizationId
            properties:
                type:
                    type: string
                    description: Type of synchronization (current buildings or removed buildings)
                    enum:
                        - "current"
                        - "removed"
                    examples:
                        - "current"
                        - "removed"
                source:
                    type: string
                    description: Data source identifier (e.g., "mhmp" for Hlavní město Praha)
                    examples:
                        - "mhmp"
                organizationId:
                    type: number
                    description: ENO organizace id (idOrganizace) the sync is scoped to
                    examples:
                        - 1
                        - 51
                daysBack:
                    type: number
                    description: Optional parameter for incremental synchronization - number of days to look back. If not provided, performs full synchronization.
                    minimum: 1
                    examples:
                        - 7
                        - 30
                        - 90
            additionalProperties: false
        energetics.IEnoGeometryTaskInput:
            type: object
            required:
                - source
                - listGid
                - organizationId
            properties:
                source:
                    type: string
                    description: Data source identifier (e.g., "mhmp" for Hlavní město Praha)
                    examples:
                        - "mhmp"
                listGid:
                    type: array
                    items:
                        type: string
                    description: List of GID identifiers for which to fetch geometry data
                    examples:
                        - ["GID312203", "GID311624"]
                organizationId:
                    type: number
                    description: ENO organizace id (idOrganizace) the geometry belongs to
                    examples:
                        - 1
                        - 51
            additionalProperties: false
        energetics.IEnoOrganizationSyncTaskInput:
            type: object
            required:
                - type
            properties:
                type:
                    type: string
                    description: Type of synchronization (current buildings/structures or removed buildings/structures)
                    enum:
                        - "current"
                        - "removed"
                    examples:
                        - "current"
                        - "removed"
                daysBack:
                    type: number
                    description: Optional parameter for incremental synchronization - number of days to look back. If not provided, performs full synchronization.
                    minimum: 1
                    examples:
                        - 7
                        - 30
                        - 90
            additionalProperties: false

