# 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, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.employment_type_response import EmploymentTypeResponse
from openapi_client.models.job_level_response import JobLevelResponse
from openapi_client.models.job_title_response import JobTitleResponse
from openapi_client.models.location_response import LocationResponse
from openapi_client.models.organization_response import OrganizationResponse
from openapi_client.models.place_of_birth_response import PlaceOfBirthResponse
from openapi_client.models.point_of_hire_response import PointOfHireResponse
from openapi_client.models.religion_response import ReligionResponse
from typing import Optional, Set
from typing_extensions import Self

class EmployeeCreateResponse(BaseModel):
    """
    EmployeeCreateResponse
    """ # noqa: E501
    id: Optional[StrictStr] = None
    marital_status: Optional[StrictStr] = Field(default=None, alias="maritalStatus")
    religion: Optional[ReligionResponse] = None
    foreign_labour: Optional[StrictBool] = Field(default=None, alias="foreignLabour")
    citizenship: Optional[Dict[str, Any]] = None
    identification_number: Optional[StrictStr] = Field(default=None, alias="identificationNumber")
    name: Optional[StrictStr] = None
    date_of_birth: Optional[StrictStr] = Field(default=None, alias="dateOfBirth")
    place_of_birth: Optional[PlaceOfBirthResponse] = Field(default=None, alias="placeOfBirth")
    join_date: Optional[StrictStr] = Field(default=None, alias="joinDate")
    start_date: Optional[StrictStr] = Field(default=None, alias="startDate")
    gender: Optional[StrictStr] = None
    point_of_hire: Optional[PointOfHireResponse] = Field(default=None, alias="pointOfHire")
    employment_status_number: Optional[StrictStr] = Field(default=None, alias="employmentStatusNumber")
    organization: Optional[OrganizationResponse] = None
    job_title: Optional[JobTitleResponse] = Field(default=None, alias="jobTitle")
    job_level: Optional[JobLevelResponse] = Field(default=None, alias="jobLevel")
    location: Optional[LocationResponse] = None
    employment_type: Optional[EmploymentTypeResponse] = Field(default=None, alias="employmentType")
    contract_start: Optional[StrictStr] = Field(default=None, alias="contractStart")
    contract_end: Optional[StrictStr] = Field(default=None, alias="contractEnd")
    identity_card_number: Optional[StrictStr] = Field(default=None, alias="identityCardNumber")
    identity_card_expired_date: Optional[date] = Field(default=None, alias="identityCardExpiredDate")
    email: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["id", "maritalStatus", "religion", "foreignLabour", "citizenship", "identificationNumber", "name", "dateOfBirth", "placeOfBirth", "joinDate", "startDate", "gender", "pointOfHire", "employmentStatusNumber", "organization", "jobTitle", "jobLevel", "location", "employmentType", "contractStart", "contractEnd", "identityCardNumber", "identityCardExpiredDate", "email"]

    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 EmployeeCreateResponse 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 religion
        if self.religion:
            _dict['religion'] = self.religion.to_dict()
        # override the default output from pydantic by calling `to_dict()` of place_of_birth
        if self.place_of_birth:
            _dict['placeOfBirth'] = self.place_of_birth.to_dict()
        # override the default output from pydantic by calling `to_dict()` of point_of_hire
        if self.point_of_hire:
            _dict['pointOfHire'] = self.point_of_hire.to_dict()
        # override the default output from pydantic by calling `to_dict()` of organization
        if self.organization:
            _dict['organization'] = self.organization.to_dict()
        # override the default output from pydantic by calling `to_dict()` of job_title
        if self.job_title:
            _dict['jobTitle'] = self.job_title.to_dict()
        # override the default output from pydantic by calling `to_dict()` of job_level
        if self.job_level:
            _dict['jobLevel'] = self.job_level.to_dict()
        # override the default output from pydantic by calling `to_dict()` of location
        if self.location:
            _dict['location'] = self.location.to_dict()
        # override the default output from pydantic by calling `to_dict()` of employment_type
        if self.employment_type:
            _dict['employmentType'] = self.employment_type.to_dict()
        # set to None if citizenship (nullable) is None
        # and model_fields_set contains the field
        if self.citizenship is None and "citizenship" in self.model_fields_set:
            _dict['citizenship'] = None

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

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

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

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

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

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

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of EmployeeCreateResponse 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"),
            "maritalStatus": obj.get("maritalStatus"),
            "religion": ReligionResponse.from_dict(obj["religion"]) if obj.get("religion") is not None else None,
            "foreignLabour": obj.get("foreignLabour"),
            "citizenship": obj.get("citizenship"),
            "identificationNumber": obj.get("identificationNumber"),
            "name": obj.get("name"),
            "dateOfBirth": obj.get("dateOfBirth"),
            "placeOfBirth": PlaceOfBirthResponse.from_dict(obj["placeOfBirth"]) if obj.get("placeOfBirth") is not None else None,
            "joinDate": obj.get("joinDate"),
            "startDate": obj.get("startDate"),
            "gender": obj.get("gender"),
            "pointOfHire": PointOfHireResponse.from_dict(obj["pointOfHire"]) if obj.get("pointOfHire") is not None else None,
            "employmentStatusNumber": obj.get("employmentStatusNumber"),
            "organization": OrganizationResponse.from_dict(obj["organization"]) if obj.get("organization") is not None else None,
            "jobTitle": JobTitleResponse.from_dict(obj["jobTitle"]) if obj.get("jobTitle") is not None else None,
            "jobLevel": JobLevelResponse.from_dict(obj["jobLevel"]) if obj.get("jobLevel") is not None else None,
            "location": LocationResponse.from_dict(obj["location"]) if obj.get("location") is not None else None,
            "employmentType": EmploymentTypeResponse.from_dict(obj["employmentType"]) if obj.get("employmentType") is not None else None,
            "contractStart": obj.get("contractStart"),
            "contractEnd": obj.get("contractEnd"),
            "identityCardNumber": obj.get("identityCardNumber"),
            "identityCardExpiredDate": obj.get("identityCardExpiredDate"),
            "email": obj.get("email")
        })
        return _obj


