# coding: utf-8

"""
    CustomerManagementService

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

    The version of the OpenAPI document: 1.0.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 pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union, Set
from typing_extensions import Self

class Address(BaseModel):
    """
    Address
    """ # noqa: E501
    city: Optional[StrictStr] = Field(default=None, alias="City")
    country_code: Optional[StrictStr] = Field(default=None, alias="CountryCode")
    id: Optional[StrictStr] = Field(default=None, alias="Id")
    line1: Optional[StrictStr] = Field(default=None, alias="Line1")
    line2: Optional[StrictStr] = Field(default=None, alias="Line2")
    line3: Optional[StrictStr] = Field(default=None, alias="Line3")
    line4: Optional[StrictStr] = Field(default=None, alias="Line4")
    postal_code: Optional[StrictStr] = Field(default=None, alias="PostalCode")
    state_or_province: Optional[StrictStr] = Field(default=None, alias="StateOrProvince")
    time_stamp: Optional[StrictStr] = Field(default=None, alias="TimeStamp")
    business_name: Optional[StrictStr] = Field(default=None, alias="BusinessName")
    __properties: ClassVar[List[str]] = ["City", "CountryCode", "Id", "Line1", "Line2", "Line3", "Line4", "PostalCode", "StateOrProvince", "TimeStamp", "BusinessName"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )
	

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # set to None if city (nullable) is None
        # and model_fields_set contains the field
        if self.city is None and "city" in self.model_fields_set:
            _dict['City'] = None

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

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

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

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

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

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

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

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

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

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

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of Address from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "City": obj.get("City") if obj.get("City") is not None else None,
                        "CountryCode": obj.get("CountryCode") if obj.get("CountryCode") is not None else None,
                        "Id": obj.get("Id") if obj.get("Id") is not None else None,
                        "Line1": obj.get("Line1") if obj.get("Line1") is not None else None,
                        "Line2": obj.get("Line2") if obj.get("Line2") is not None else None,
                        "Line3": obj.get("Line3") if obj.get("Line3") is not None else None,
                        "Line4": obj.get("Line4") if obj.get("Line4") is not None else None,
                        "PostalCode": obj.get("PostalCode") if obj.get("PostalCode") is not None else None,
                        "StateOrProvince": obj.get("StateOrProvince") if obj.get("StateOrProvince") is not None else None,
                        "TimeStamp": obj.get("TimeStamp") if obj.get("TimeStamp") is not None else None,
                        "BusinessName": obj.get("BusinessName") if obj.get("BusinessName") is not None else None
        })
        return _obj
