# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ReadingCreate(Model):
    """ReadingCreate.

    All required parameters must be populated in order to send to Azure.

    :param channel_id:  Channel Identification
     The channel that receives the reading is determined by the following
     rules:
     Direct pointers to a channel
     If the channelId is supplied, then import to that channel.
     If the channelId is not supplied look at the channelImportId property,
     which indicates a specific channel.
     Inferred pointers to a channel
     If the channelId and channelImportId are not supplied, look at the
     meterImportId property, which indicates a meter.If that meter has one
     channel, import to that channel.
     If that meter has more than one channel, find the channel with the same
     observation type as the observationTypeCode property.If only one is found,
     import to that channel.
     If more than one channel is found based on observation type, find the
     channel with the same output unit as the unitCode property.If only one is
     found, import to that channel.
     If more than one channel is found based on unit, find the channel with the
     same channelIntervalInSeconds property. If only one is found, import to
     that channel. <span class='property-internal'>Topmost (Channel)</span>
    :type channel_id: int
    :param channel_import_id: The import identifier for the channel on which
     to create the reading. See the channelId property for more information
     <span class='property-internal'>Must be between 0 and 255
     characters</span>
    :type channel_import_id: str
    :param meter_import_id: The import identifier for the meter on which to
     create the reading. See the channelId property for more information <span
     class='property-internal'>Must be between 0 and 255 characters</span>
    :type meter_import_id: str
    :param channel_interval_in_seconds:
    :type channel_interval_in_seconds: int
    :param observation_type_code: The observationType code of the reading. See
     the channelId property for more information <span
     class='property-internal'>Must be between 0 and 16 characters</span>
    :type observation_type_code: str
    :param unit_code: The unit code of the reading. See the channelId property
     for more information <span class='property-internal'>Must be between 0 and
     16 characters</span>
    :type unit_code: str
    :param readings: Required. array of readings <span
     class='property-internal'>Required</span>
    :type readings: list[~energycap.sdk.models.Reading]
    """

    _validation = {
        'channel_import_id': {'max_length': 255, 'min_length': 0},
        'meter_import_id': {'max_length': 255, 'min_length': 0},
        'observation_type_code': {'max_length': 16, 'min_length': 0},
        'unit_code': {'max_length': 16, 'min_length': 0},
        'readings': {'required': True},
    }

    _attribute_map = {
        'channel_id': {'key': 'channelId', 'type': 'int'},
        'channel_import_id': {'key': 'channelImportId', 'type': 'str'},
        'meter_import_id': {'key': 'meterImportId', 'type': 'str'},
        'channel_interval_in_seconds': {'key': 'channelIntervalInSeconds', 'type': 'int'},
        'observation_type_code': {'key': 'observationTypeCode', 'type': 'str'},
        'unit_code': {'key': 'unitCode', 'type': 'str'},
        'readings': {'key': 'readings', 'type': '[Reading]'},
    }

    def __init__(self, *, readings, channel_id: int=None, channel_import_id: str=None, meter_import_id: str=None, channel_interval_in_seconds: int=None, observation_type_code: str=None, unit_code: str=None, **kwargs) -> None:
        super(ReadingCreate, self).__init__(**kwargs)
        self.channel_id = channel_id
        self.channel_import_id = channel_import_id
        self.meter_import_id = meter_import_id
        self.channel_interval_in_seconds = channel_interval_in_seconds
        self.observation_type_code = observation_type_code
        self.unit_code = unit_code
        self.readings = readings
