// Copyright (C) 2026 Fredrik Öhrström (gpl-3.0-or-later)
library {
    fields {
        field {
            id       = total_m3
            name     = total
            quantity = Volume
            info     = 'The total water consumption.'
            match {
                measurement_type = Instantaneous
                vif_range        = Volume
            }
        }
        field {
            id       = max_flow_m3h
            name     = max_flow
            quantity = Flow
            info     = 'The maximum water flow recorded.'
            match {
                measurement_type = Instantaneous
                vif_range        = VolumeFlow
            }
        }
        field {
            id         = status-tpl-only
            name       = status
            quantity   = Text
            info       = 'Status and error flags.'
            attributes = STATUS,INCLUDE_TPL_STATUS
        }
        field {
            id           = actuality_duration_s
            name         = actuality_duration
            info         = 'Lapsed time between measurement and transmission.'
            quantity     = Time
            display_unit = s
            match {
                measurement_type = Instantaneous
                vif_range        = ActualityDuration
            }
        }
        field {
            id       = actuality_duration_h
            name     = actuality_duration
            info     = 'Lapsed time between measurement and transmission.'
            quantity = Time
            match {
                measurement_type = Instantaneous
                vif_range        = ActualityDuration
            }
        }
        field {
            id       = battery_y
            name     = battery
            info     = 'Battery voltage.'
            quantity = Voltage
            match {
                measurement_type = Instantaneous
                vif_range        = Voltage
            }
        }
        field {
            id   = fabrication_no
            name = fabrication
            info = 'Fabrication number.'
            match {
                measurement_type = Instantaneous
                vif_range        = FabricationNo
            }
        }
        field {
            id   = enhanced_id
            name = enhanced_id
            info = 'Enhanced identification number.'
            match {
                measurement_type = Instantaneous
                vif_range        = EnhancedIdentification
            }
        }
        field {
            id   = software_version
            name = software_version
            info = 'Software version.'
            match {
                measurement_type = Instantaneous
                vif_range        = SoftwareVersion
            }
        }
        field {
            id   = manufacturer
            name = software_version
            info = 'Meter manufacturer.'
            match {
                measurement_type = Instantaneous
                vif_range        = Manufacturer
            }
        }
        field {
            id   = model_version
            name = model_version
            info = 'Meter model version.'
            match {
                measurement_type = Instantaneous
                vif_range        = ModelVersion
            }
        }
        field {
            id   = firmware_version
            name = firmware_version
            info = 'Meter firmware version.'
            match {
                measurement_type = Instantaneous
                vif_range        = FirmwareVersion
            }
        }
        field {
            id   = parameter_set
            name = parameter_set
            info = 'Parameter set for this meter.'
            match {
                measurement_type = Instantaneous
                vif_range        = ParameterSet
            }
        }
        field {
            id   = customer
            name = customer
            info = 'Customer name.'
            match {
                measurement_type = Instantaneous
                vif_range        = Customer
            }
        }
        field {
            id   = location
            name = location
            info = 'Meter installed at this customer location.'
            match {
                measurement_type = Instantaneous
                vif_range        = Location
            }
        }
        field {
            id       = operating_time_h
            name     = operating_time
            info     = 'How long the meter has been collecting data.'
            quantity = Time
            match {
                measurement_type = Instantaneous
                vif_range        = OperatingTime
            }
        }
        field {
            id       = on_time_h
            name     = on_time
            info     = 'How long the meter has been powered up.'
            quantity = Time
            match {
                measurement_type = Instantaneous
                vif_range        = OnTime
            }
        }
        field {
            id       = on_time_at_error_h
            name     = on_time_at_error
            info     = 'How long the meter has been in an error state while powered up.'
            quantity = Time
            match {
                measurement_type = AtError
                vif_range        = OnTime
            }
        }
        field {
            id           = meter_date
            name         = meter
            quantity     = PointInTime
            info         = 'Date when the meter sent the telegram.'
            display_unit = DateLT
            match {
                measurement_type = Instantaneous
                vif_range        = Date
            }
        }
        field {
            id       = meter_datetime
            name     = meter
            quantity = PointInTime
            info     = 'Date and time when the meter sent the telegram.'
            match {
                measurement_type = Instantaneous
                vif_range        = DateTime
            }
        }
        field {
            id       = total_m3
            name     = total
            into     = 'The total media volume consumption recorded by this meter.'
            quantity = Volume
            match {
                measurement_type = Instantaneous
                vif_range        = Volume
            }
        }
        field {
            id       = target_m3
            name     = target
            info     = 'The volume recorded by this meter at the end of the last billing period.'
            quantity = Volume
            match {
                measurement_type = Instantaneous
                vif_range        = Volume
                storage_nr       = 1
            }
        }
        field {
            id       = total_kwh
            name     = total
            info     = 'The total energy consumption recorded by this meter.'
            quantity = Energy
            match {
                measurement_type = Instantaneous
                vif_range        = AnyEnergyVIF
            }
        }
        field {
            id       = target_kwh
            name     = target
            info     = 'The energy recorded by this meter at the end of the last billing period.'
            quantity = Energy
            match {
                measurement_type = Instantaneous
                vif_range        = AnyEnergyVIF
                storage_nr       = 1
            }
        }
        field {
            id           = target_date
            name         = target
            info         = 'The target date is the end of the previous billing period, usually the end of the last month.'
            quantity     = PointInTime
            display_unit = DateLT
            match {
                measurement_type = Instantaneous
                vif_range        = Date
                storage_nr       = 1
            }
        }
        field {
            id       = total_forward_m3
            name     = total_forward
            info     = 'The total media volume flowing forward.'
            quantity = Volume
            match {
                measurement_type = Instantaneous
                vif_range        = Volume
                add_combinable   = ForwardFlow
            }
        }
        field {
            id       = total_backward_m3
            name     = total_backward
            info     = 'The total media volume flowing backward.'
            quantity = Volume
            match {
                measurement_type = Instantaneous
                vif_range        = Volume
                add_combinable   = BackwardFlow
            }
        }
        field {
            id       = flow_temperature_c
            name     = flow_temperature
            info     = 'Forward media temperature.'
            quantity = Temperature
            match {
                measurement_type = Instantaneous
                vif_range        = FlowTemperature
            }
        }
        field {
            id       = external_temperature_c
            name     = external_temperature
            info     = 'Temperature outside of meter.'
            quantity = Temperature
            match {
                measurement_type = Instantaneous
                vif_range        = ExternalTemperature
            }
        }
        field {
            id       = return_temperature_c
            name     = return_temperature
            info     = 'Return media temperature.'
            quantity = Temperature
            match {
                measurement_type = Instantaneous
                vif_range        = ReturnTemperature
            }
        }
        field {
            id       = flow_return_temperature_difference_c
            name     = flow_return_temperature_difference
            info     = 'The difference between flow and return media temperatures.'
            quantity = Temperature
            match {
                measurement_type = Instantaneous
                vif_range        = TemperatureDifference
            }
        }
        field {
            id       = volume_flow_m3h
            name     = volume_flow
            info     = 'Media volume flow'
            quantity = Flow
            match {
                measurement_type = Instantaneous
                vif_range        = VolumeFlow
            }
        }
        field {
            id             = access_counter
            name           = access
            info           = 'Meter access counter.'
            quantity       = Dimensionless
            vif_scaling    = None
            dif_signedness = Unsigned
            match {
                measurement_type = Instantaneous
                vif_range        = AccessNumber
            }
        }
        field {
            id       = consumption_hca
            name     = consumption
            info     = 'The current heat cost allocation for this meter.'
            quantity = HCA
            match {
                measurement_type = Instantaneous
                vif_range        = HeatCostAllocation
            }
        }
        field {
            id       = target_hca
            name     = target
            info     = 'The heat cost allocation recorded by this meter at the target date.'
            quantity = HCA
            match {
                measurement_type = Instantaneous
                vif_range        = HeatCostAllocation
                storage_nr       = 1
            }
        }
    }
}