# coding: utf-8

"""
    SmartHome

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 1.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field, StrictStr

class MetersResponse(BaseModel):
    """
    MetersResponse
    """
    address_meter_id: Optional[StrictStr] = Field(None, alias="addressMeterId")
    address: Optional[StrictStr] = None
    identifier: Optional[StrictStr] = None
    manufacturer: Optional[StrictStr] = None
    model: Optional[StrictStr] = None
    access_from: Optional[datetime] = Field(None, alias="accessFrom")
    access_to: Optional[datetime] = Field(None, alias="accessTo")
    meter_counter_type: Optional[StrictStr] = Field(None, alias="meterCounterType")
    __properties = ["addressMeterId", "address", "identifier", "manufacturer", "model", "accessFrom", "accessTo", "meterCounterType"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> MetersResponse:
        """Create an instance of MetersResponse from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # set to None if address (nullable) is None
        # and __fields_set__ contains the field
        if self.address is None and "address" in self.__fields_set__:
            _dict['address'] = None

        # set to None if identifier (nullable) is None
        # and __fields_set__ contains the field
        if self.identifier is None and "identifier" in self.__fields_set__:
            _dict['identifier'] = None

        # set to None if manufacturer (nullable) is None
        # and __fields_set__ contains the field
        if self.manufacturer is None and "manufacturer" in self.__fields_set__:
            _dict['manufacturer'] = None

        # set to None if model (nullable) is None
        # and __fields_set__ contains the field
        if self.model is None and "model" in self.__fields_set__:
            _dict['model'] = None

        # set to None if access_to (nullable) is None
        # and __fields_set__ contains the field
        if self.access_to is None and "access_to" in self.__fields_set__:
            _dict['accessTo'] = None

        # set to None if meter_counter_type (nullable) is None
        # and __fields_set__ contains the field
        if self.meter_counter_type is None and "meter_counter_type" in self.__fields_set__:
            _dict['meterCounterType'] = None

        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> MetersResponse:
        """Create an instance of MetersResponse from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return MetersResponse.parse_obj(obj)

        _obj = MetersResponse.parse_obj({
            "address_meter_id": obj.get("addressMeterId"),
            "address": obj.get("address"),
            "identifier": obj.get("identifier"),
            "manufacturer": obj.get("manufacturer"),
            "model": obj.get("model"),
            "access_from": obj.get("accessFrom"),
            "access_to": obj.get("accessTo"),
            "meter_counter_type": obj.get("meterCounterType")
        })
        return _obj


