openapi: 3.0.3
info:
    title: ⚡ Energetics
    description: >-
        <p> ⚡ Energetika</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

paths:
    /ptas/{id}:
        post:
            parameters:
                - in: path
                  name: id
                  required: true
                  schema:
                      type: integer
                      minimum: 1
                  example: 3336025
            description: The meter ID
            tags:
                - ⚡ Energetics
            summary: Receive and save data
            requestBody:
                content:
                    text/csv:
                        schema:
                            $ref: "#/components/schemas/PtasMeasurement"
                        examples:
                            text/csv:
                                summary: Sample data
                                value:
                                    "Datum odečtu;Čas odečtu;Výrobní číslo;Druh registru;Odečet;MJ odečtu;MJ zúčt.;OM závislé;Typ odečtu;Status odečtu

                                    25.4.2024;00:56;68837353;Teplo horké vody;2 969,03;GJ;GJ;;;nenalezeno"

            responses:
                204:
                    description: OK
                401:
                    $ref: "#/components/responses/UnauthorizedError"
                404:
                    description: Not found
                422:
                    description: Error while validating input data
    /pre:
        post:
            description: Input for PRE json data
            tags:
                - ⚡ Energetics
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: "#/components/schemas/PreMeasurement"
                        examples:
                            application/json:
                                summary: Example input
                                value:
                                    "{
    \"project_name\": \"REPORT_PRAHA_OICT\",
    \"stored_month\": {
        \"year\": 2024,
        \"month\": 11,
        \"companies\": {
            \"70872503\": {
                \"trade_name\": \"TEST Operátor ICT a.s.\",
                \"EAN_list\": {
                    \"859182400306074267\": {
                        \"address\": \"Dělnická 213/12, Praha 7, 170 00\",
                        \"tarif_type\": \"C03d\",
                        \"tarif_1T2T\": \"1T\",
                        \"phases\": \"3F\",
                        \"circuit_breaker\": \"160\",
                        \"location_type\": \"TEST\",
                        \"found_in_converge_reports\": \"YES\",
                        \"type_B_meter\": \"YES\",
                        \"meter_replaced\": \"NO\",
                        \"device_serial_number\": \"123456789\",
                        \"daily_data_Wh_per_EAN\": {
                            \"T1_Wh_raw_data\": [
                                [
                                    [
                                        \"30.11.2024 00:15\",
                                        10
                                    ],
                                    [
                                        \"30.11.2024 00:30\",
                                        12
                                    ]
                                ]
                            ],
                            \"T2_Wh_raw_data\": [
                                [
                                    [
                                        \"30.11.2024 00:15\",
                                        0
                                    ],
                                    [
                                        \"30.11.2024 00:30\",
                                        0
                                    ]
                                ]
                            ],
                            \"T1_Wh_total\": [244.0, 237.0],
                            \"T2_Wh_total\": [0.0, 0.0],
                            \"T1_plus_T2_Wh_total\": [244.0, 237.0]
                        }
                    }
                }
            }
        }
    }
}"
            responses:
                204:
                    description: OK
                401:
                    $ref: "#/components/responses/UnauthorizedError"
                422:
                    description: Error while validating input data
    /pre/csv:
        post:
            tags:
                - ⚡ Energetics
            summary: Receive and save PRE data in CSV format
            requestBody:
                content:
                    text/csv:
                        schema:
                            $ref: "#/components/schemas/PreCsvMeasurement"
                        examples:
                            text/csv:
                                summary: Sample data
                                value:
                                    "Počátek intervalu;Konec intervalu;859182400300027238 - Činná - spotřeba [kW];859182400300027238 - Induktivní - spotřeba [kVAr];859182400300027238 - Kapacitní - spotřeba [kVAr];

                                     01.01.2021 00:00;01.01.2021 00:15;57,000;0,000;5,000;"
            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:
        PtasMeasurement:
            type: object
            required:
                - Datum odečtu
                - Čas odečtu
                - Výrobní číslo
                - Druh registru
                - Odečet
                - MJ odečtu
                - MJ zúčt.
                - OM závislé
                - Typ odečtu
                - Status odečtu
            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
        PreCsvMeasurement:
            type: object
            properties:
                Počátek intervalu:
                    type: string
                Konec intervalu:
                    type: string
            required:
                - Počátek intervalu
                - Konec intervalu
        PreMeasurement:
            type: object
            properties:
                stored_month:
                    type: object
                    properties:
                        companies:
                            type: object


