# 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.contact_info import ContactInfo
from openapi_client.models.customer.key_value_pair_ofstring_andstring import KeyValuePairOfstringAndstring
from openapi_client.models.customer.lcid import LCID
from openapi_client.models.customer.person_name import PersonName
from openapi_client.models.customer.secret_question import SecretQuestion
from openapi_client.models.customer.user_life_cycle_status import UserLifeCycleStatus
from typing_extensions import Self

class User(BaseModel):
    """
    User
    """ # noqa: E501
    contact_info: Optional[ContactInfo] = Field(default=None, alias="ContactInfo")
    customer_id: Optional[StrictStr] = Field(default=None, alias="CustomerId")
    id: Optional[StrictStr] = Field(default=None, alias="Id")
    job_title: Optional[StrictStr] = Field(default=None, alias="JobTitle")
    last_modified_by_user_id: Optional[StrictStr] = Field(default=None, alias="LastModifiedByUserId")
    last_modified_time: Optional[datetime] = Field(default=None, alias="LastModifiedTime")
    lcid: Optional[LCID] = Field(default=None, alias="Lcid")
    name: Optional[PersonName] = Field(default=None, alias="Name")
    password: Optional[StrictStr] = Field(default=None, alias="Password")
    secret_answer: Optional[StrictStr] = Field(default=None, alias="SecretAnswer")
    secret_question: Optional[SecretQuestion] = Field(default=None, alias="SecretQuestion")
    user_life_cycle_status: Optional[UserLifeCycleStatus] = Field(default=None, alias="UserLifeCycleStatus")
    time_stamp: Optional[StrictStr] = Field(default=None, alias="TimeStamp")
    user_name: Optional[StrictStr] = Field(default=None, alias="UserName")
    forward_compatibility_map: Optional[List[Optional[KeyValuePairOfstringAndstring]]] = Field(default=None, alias="ForwardCompatibilityMap")
    authentication_token: Optional[StrictStr] = Field(default=None, alias="AuthenticationToken")
    __properties: ClassVar[List[str]] = ["ContactInfo", "CustomerId", "Id", "JobTitle", "LastModifiedByUserId", "LastModifiedTime", "Lcid", "Name", "Password", "SecretAnswer", "SecretQuestion", "UserLifeCycleStatus", "TimeStamp", "UserName", "ForwardCompatibilityMap", "AuthenticationToken"]

    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 contact_info
        if self.contact_info:
            _dict['ContactInfo'] = self.contact_info.to_dict()
        # override the default output from pydantic by calling `to_dict()` of name
        if self.name:
            _dict['Name'] = self.name.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 contact_info (nullable) is None
        # and model_fields_set contains the field
        if self.contact_info is None and "contact_info" in self.model_fields_set:
            _dict['ContactInfo'] = None

        # set to None if customer_id (nullable) is None
        # and model_fields_set contains the field
        if self.customer_id is None and "customer_id" in self.model_fields_set:
            _dict['CustomerId'] = 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 job_title (nullable) is None
        # and model_fields_set contains the field
        if self.job_title is None and "job_title" in self.model_fields_set:
            _dict['JobTitle'] = 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 lcid (nullable) is None
        # and model_fields_set contains the field
        if self.lcid is None and "lcid" in self.model_fields_set:
            _dict['Lcid'] = 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 password (nullable) is None
        # and model_fields_set contains the field
        if self.password is None and "password" in self.model_fields_set:
            _dict['Password'] = None

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "ContactInfo": ContactInfo.from_dict(obj["ContactInfo"]) if obj.get("ContactInfo") is not None else None,
                        "CustomerId": obj.get("CustomerId") if obj.get("CustomerId") is not None else None,
                        "Id": obj.get("Id") if obj.get("Id") is not None else None,
                        "JobTitle": obj.get("JobTitle") if obj.get("JobTitle") 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,
                        "Lcid": obj.get("Lcid") if obj.get("Lcid") is not None else None,
                        "Name": PersonName.from_dict(obj["Name"]) if obj.get("Name") is not None else None,
                        "Password": obj.get("Password") if obj.get("Password") is not None else None,
                        "SecretAnswer": obj.get("SecretAnswer") if obj.get("SecretAnswer") is not None else None,
                        "SecretQuestion": obj.get("SecretQuestion") if obj.get("SecretQuestion") is not None else None,
                        "UserLifeCycleStatus": obj.get("UserLifeCycleStatus") if obj.get("UserLifeCycleStatus") is not None else None,
                        "TimeStamp": obj.get("TimeStamp") if obj.get("TimeStamp") is not None else None,
                        "UserName": obj.get("UserName") if obj.get("UserName") is not None else None,
                        "ForwardCompatibilityMap": [KeyValuePairOfstringAndstring.from_dict(_item) for _item in obj["ForwardCompatibilityMap"]] if obj.get("ForwardCompatibilityMap") is not None else None,
                        "AuthenticationToken": obj.get("AuthenticationToken") if obj.get("AuthenticationToken") is not None else None
        })
        return _obj
