# 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 openapi_client.models.customer.address import Address
from openapi_client.models.customer.customer_financial_status import CustomerFinancialStatus
from openapi_client.models.customer.customer_life_cycle_status import CustomerLifeCycleStatus
from openapi_client.models.customer.industry import Industry
from openapi_client.models.customer.key_value_pair_ofstring_andstring import KeyValuePairOfstringAndstring
from openapi_client.models.customer.language_type import LanguageType
from openapi_client.models.customer.service_level import ServiceLevel
from typing_extensions import Self

class Customer(BaseModel):
    """
    Customer
    """ # noqa: E501
    customer_financial_status: Optional[CustomerFinancialStatus] = Field(default=None, alias="CustomerFinancialStatus")
    id: Optional[StrictStr] = Field(default=None, alias="Id")
    industry: Optional[Industry] = Field(default=None, alias="Industry")
    last_modified_by_user_id: Optional[StrictStr] = Field(default=None, alias="LastModifiedByUserId")
    last_modified_time: Optional[datetime] = Field(default=None, alias="LastModifiedTime")
    market_country: Optional[StrictStr] = Field(default=None, alias="MarketCountry")
    market_language: Optional[LanguageType] = Field(default=None, alias="MarketLanguage")
    name: Optional[StrictStr] = Field(default=None, alias="Name")
    service_level: Optional[ServiceLevel] = Field(default=None, alias="ServiceLevel")
    customer_life_cycle_status: Optional[CustomerLifeCycleStatus] = Field(default=None, alias="CustomerLifeCycleStatus")
    time_stamp: Optional[StrictStr] = Field(default=None, alias="TimeStamp")
    number: Optional[StrictStr] = Field(default=None, alias="Number")
    customer_address: Optional[Address] = Field(default=None, alias="CustomerAddress")
    forward_compatibility_map: Optional[List[Optional[KeyValuePairOfstringAndstring]]] = Field(default=None, alias="ForwardCompatibilityMap")
    __properties: ClassVar[List[str]] = ["CustomerFinancialStatus", "Id", "Industry", "LastModifiedByUserId", "LastModifiedTime", "MarketCountry", "MarketLanguage", "Name", "ServiceLevel", "CustomerLifeCycleStatus", "TimeStamp", "Number", "CustomerAddress", "ForwardCompatibilityMap"]

    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,
        )
        # override the default output from pydantic by calling `to_dict()` of customer_address
        if self.customer_address:
            _dict['CustomerAddress'] = self.customer_address.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in forward_compatibility_map (list)
        _items = []
        if self.forward_compatibility_map:
            for _item_forward_compatibility_map in self.forward_compatibility_map:
                if _item_forward_compatibility_map:
                    _items.append(_item_forward_compatibility_map.to_dict())
            _dict['ForwardCompatibilityMap'] = _items
        # set to None if customer_financial_status (nullable) is None
        # and model_fields_set contains the field
        if self.customer_financial_status is None and "customer_financial_status" in self.model_fields_set:
            _dict['CustomerFinancialStatus'] = 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 industry (nullable) is None
        # and model_fields_set contains the field
        if self.industry is None and "industry" in self.model_fields_set:
            _dict['Industry'] = None

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

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

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

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

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

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

        # set to None if customer_life_cycle_status (nullable) is None
        # and model_fields_set contains the field
        if self.customer_life_cycle_status is None and "customer_life_cycle_status" in self.model_fields_set:
            _dict['CustomerLifeCycleStatus'] = 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 number (nullable) is None
        # and model_fields_set contains the field
        if self.number is None and "number" in self.model_fields_set:
            _dict['Number'] = None

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "CustomerFinancialStatus": obj.get("CustomerFinancialStatus") if obj.get("CustomerFinancialStatus") is not None else None,
                        "Id": obj.get("Id") if obj.get("Id") is not None else None,
                        "Industry": obj.get("Industry") if obj.get("Industry") is not None else None,
                        "LastModifiedByUserId": obj.get("LastModifiedByUserId") if obj.get("LastModifiedByUserId") is not None else None,
                        "LastModifiedTime": obj.get("LastModifiedTime") if obj.get("LastModifiedTime") is not None else None,
                        "MarketCountry": obj.get("MarketCountry") if obj.get("MarketCountry") is not None else None,
                        "MarketLanguage": obj.get("MarketLanguage") if obj.get("MarketLanguage") is not None else None,
                        "Name": obj.get("Name") if obj.get("Name") is not None else None,
                        "ServiceLevel": obj.get("ServiceLevel") if obj.get("ServiceLevel") is not None else None,
                        "CustomerLifeCycleStatus": obj.get("CustomerLifeCycleStatus") if obj.get("CustomerLifeCycleStatus") is not None else None,
                        "TimeStamp": obj.get("TimeStamp") if obj.get("TimeStamp") is not None else None,
                        "Number": obj.get("Number") if obj.get("Number") is not None else None,
                        "CustomerAddress": Address.from_dict(obj["CustomerAddress"]) if obj.get("CustomerAddress") is not None else None,
                        "ForwardCompatibilityMap": [KeyValuePairOfstringAndstring.from_dict(_item) for _item in obj["ForwardCompatibilityMap"]] if obj.get("ForwardCompatibilityMap") is not None else None
        })
        return _obj
