# coding: utf-8

"""
    CATAPA API

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

    The version of the OpenAPI document: 1.0.0
    Contact: support@catapa.com
    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 date
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from openapi_client.models.address_detail_response import AddressDetailResponse
from openapi_client.models.emergency_contact_response import EmergencyContactResponse
from openapi_client.models.employee_full_response import EmployeeFullResponse
from typing import Optional, Set
from typing_extensions import Self

class ContactInformationResponse(BaseModel):
    """
    ContactInformationResponse
    """ # noqa: E501
    id: Optional[StrictStr] = None
    mobile_phone: Optional[StrictStr] = Field(default=None, alias="mobilePhone")
    email: Optional[StrictStr] = Field(default=None, description="deprecated")
    work_email: Optional[StrictStr] = Field(default=None, alias="workEmail")
    personal_email: Optional[StrictStr] = Field(default=None, alias="personalEmail")
    original_address: Optional[StrictStr] = Field(default=None, alias="originalAddress")
    original_address_phone_number: Optional[StrictStr] = Field(default=None, alias="originalAddressPhoneNumber")
    original_address_detail: Optional[AddressDetailResponse] = Field(default=None, alias="originalAddressDetail")
    facebook: Optional[StrictStr] = None
    linked_in: Optional[StrictStr] = Field(default=None, alias="linkedIn")
    effective_date: Optional[date] = Field(default=None, description="YYYY-MM-DD", alias="effectiveDate")
    created_by: Optional[StrictStr] = Field(default=None, alias="createdBy")
    created_date: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="createdDate")
    updated_by: Optional[StrictStr] = Field(default=None, alias="updatedBy")
    updated_date: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="updatedDate")
    residential_address: Optional[AddressDetailResponse] = Field(default=None, alias="residentialAddress")
    emergency_contact: Optional[EmergencyContactResponse] = Field(default=None, alias="emergencyContact")
    employee: Optional[EmployeeFullResponse] = None
    __properties: ClassVar[List[str]] = ["id", "mobilePhone", "email", "workEmail", "personalEmail", "originalAddress", "originalAddressPhoneNumber", "originalAddressDetail", "facebook", "linkedIn", "effectiveDate", "createdBy", "createdDate", "updatedBy", "updatedDate", "residentialAddress", "emergencyContact", "employee"]

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


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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

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

    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 original_address_detail
        if self.original_address_detail:
            _dict['originalAddressDetail'] = self.original_address_detail.to_dict()
        # override the default output from pydantic by calling `to_dict()` of residential_address
        if self.residential_address:
            _dict['residentialAddress'] = self.residential_address.to_dict()
        # override the default output from pydantic by calling `to_dict()` of emergency_contact
        if self.emergency_contact:
            _dict['emergencyContact'] = self.emergency_contact.to_dict()
        # override the default output from pydantic by calling `to_dict()` of employee
        if self.employee:
            _dict['employee'] = self.employee.to_dict()
        # set to None if mobile_phone (nullable) is None
        # and model_fields_set contains the field
        if self.mobile_phone is None and "mobile_phone" in self.model_fields_set:
            _dict['mobilePhone'] = None

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "id": obj.get("id"),
            "mobilePhone": obj.get("mobilePhone"),
            "email": obj.get("email"),
            "workEmail": obj.get("workEmail"),
            "personalEmail": obj.get("personalEmail"),
            "originalAddress": obj.get("originalAddress"),
            "originalAddressPhoneNumber": obj.get("originalAddressPhoneNumber"),
            "originalAddressDetail": AddressDetailResponse.from_dict(obj["originalAddressDetail"]) if obj.get("originalAddressDetail") is not None else None,
            "facebook": obj.get("facebook"),
            "linkedIn": obj.get("linkedIn"),
            "effectiveDate": obj.get("effectiveDate"),
            "createdBy": obj.get("createdBy"),
            "createdDate": obj.get("createdDate"),
            "updatedBy": obj.get("updatedBy"),
            "updatedDate": obj.get("updatedDate"),
            "residentialAddress": AddressDetailResponse.from_dict(obj["residentialAddress"]) if obj.get("residentialAddress") is not None else None,
            "emergencyContact": EmergencyContactResponse.from_dict(obj["emergencyContact"]) if obj.get("emergencyContact") is not None else None,
            "employee": EmployeeFullResponse.from_dict(obj["employee"]) if obj.get("employee") is not None else None
        })
        return _obj


