# coding: utf-8

"""
    CATAPA API

    CATAPA HR and workforce management API for payroll, organization, personnel, time management, and related operations.

    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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.cost_center_list_item_response import CostCenterListItemResponse
from openapi_client.models.employee_id_identification_number_response import EmployeeIdIdentificationNumberResponse
from openapi_client.models.employment_status_detail_position_response import EmploymentStatusDetailPositionResponse
from openapi_client.models.employment_status_type_response import EmploymentStatusTypeResponse
from openapi_client.models.employment_type_response import EmploymentTypeResponse
from openapi_client.models.id_code_name_response import IdCodeNameResponse
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.sub_location_response import SubLocationResponse
from typing import Optional, Set
from typing_extensions import Self

class EmploymentStatusHistoryDetailResponse(BaseModel):
    """
    EmploymentStatusHistoryDetailResponse
    """ # noqa: E501
    id: Optional[StrictStr] = None
    contract_start: Optional[date] = Field(default=None, description="YYYY-MM-DD", alias="contractStart")
    contract_end: Optional[date] = Field(default=None, description="YYYY-MM-DD", alias="contractEnd")
    cost_center: Optional[CostCenterListItemResponse] = Field(default=None, alias="costCenter")
    effective_date: Optional[date] = Field(default=None, description="YYYY-MM-DD", alias="effectiveDate")
    end_date: Optional[date] = Field(default=None, description="YYYY-MM-DD", alias="endDate")
    employment_status_number: Optional[StrictStr] = Field(default=None, alias="employmentStatusNumber")
    employment_status_type: Optional[EmploymentStatusTypeResponse] = Field(default=None, alias="employmentStatusType")
    employment_type: Optional[EmploymentTypeResponse] = Field(default=None, alias="employmentType")
    job_level: Optional[JobLevelResponse] = Field(default=None, alias="jobLevel")
    job_title: Optional[JobTitleResponse] = Field(default=None, alias="jobTitle")
    location: Optional[LocationResponse] = None
    organization: Optional[OrganizationResponse] = None
    permanent_date: Optional[date] = Field(default=None, description="YYYY-MM-DD", alias="permanentDate")
    sign_date: Optional[date] = Field(default=None, description="YYYY-MM-DD", alias="signDate")
    sub_location: Optional[SubLocationResponse] = Field(default=None, alias="subLocation")
    operational_group: Optional[IdCodeNameResponse] = Field(default=None, alias="operationalGroup")
    position: Optional[EmploymentStatusDetailPositionResponse] = None
    employee: Optional[EmployeeIdIdentificationNumberResponse] = None
    __properties: ClassVar[List[str]] = ["id", "contractStart", "contractEnd", "costCenter", "effectiveDate", "endDate", "employmentStatusNumber", "employmentStatusType", "employmentType", "jobLevel", "jobTitle", "location", "organization", "permanentDate", "signDate", "subLocation", "operationalGroup", "position", "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 EmploymentStatusHistoryDetailResponse 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 cost_center
        if self.cost_center:
            _dict['costCenter'] = self.cost_center.to_dict()
        # override the default output from pydantic by calling `to_dict()` of employment_status_type
        if self.employment_status_type:
            _dict['employmentStatusType'] = self.employment_status_type.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()
        # 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 job_title
        if self.job_title:
            _dict['jobTitle'] = self.job_title.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 organization
        if self.organization:
            _dict['organization'] = self.organization.to_dict()
        # override the default output from pydantic by calling `to_dict()` of sub_location
        if self.sub_location:
            _dict['subLocation'] = self.sub_location.to_dict()
        # override the default output from pydantic by calling `to_dict()` of operational_group
        if self.operational_group:
            _dict['operationalGroup'] = self.operational_group.to_dict()
        # override the default output from pydantic by calling `to_dict()` of position
        if self.position:
            _dict['position'] = self.position.to_dict()
        # override the default output from pydantic by calling `to_dict()` of employee
        if self.employee:
            _dict['employee'] = self.employee.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of EmploymentStatusHistoryDetailResponse 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"),
            "contractStart": obj.get("contractStart"),
            "contractEnd": obj.get("contractEnd"),
            "costCenter": CostCenterListItemResponse.from_dict(obj["costCenter"]) if obj.get("costCenter") is not None else None,
            "effectiveDate": obj.get("effectiveDate"),
            "endDate": obj.get("endDate"),
            "employmentStatusNumber": obj.get("employmentStatusNumber"),
            "employmentStatusType": EmploymentStatusTypeResponse.from_dict(obj["employmentStatusType"]) if obj.get("employmentStatusType") is not None else None,
            "employmentType": EmploymentTypeResponse.from_dict(obj["employmentType"]) if obj.get("employmentType") is not None else None,
            "jobLevel": JobLevelResponse.from_dict(obj["jobLevel"]) if obj.get("jobLevel") is not None else None,
            "jobTitle": JobTitleResponse.from_dict(obj["jobTitle"]) if obj.get("jobTitle") is not None else None,
            "location": LocationResponse.from_dict(obj["location"]) if obj.get("location") is not None else None,
            "organization": OrganizationResponse.from_dict(obj["organization"]) if obj.get("organization") is not None else None,
            "permanentDate": obj.get("permanentDate"),
            "signDate": obj.get("signDate"),
            "subLocation": SubLocationResponse.from_dict(obj["subLocation"]) if obj.get("subLocation") is not None else None,
            "operationalGroup": IdCodeNameResponse.from_dict(obj["operationalGroup"]) if obj.get("operationalGroup") is not None else None,
            "position": EmploymentStatusDetailPositionResponse.from_dict(obj["position"]) if obj.get("position") is not None else None,
            "employee": EmployeeIdIdentificationNumberResponse.from_dict(obj["employee"]) if obj.get("employee") is not None else None
        })
        return _obj


