# 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
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.id_response import IdResponse
from typing import Optional, Set
from typing_extensions import Self

class PayrollProcessSnapshotEmploymentStatusResponse(BaseModel):
    """
    PayrollProcessSnapshotEmploymentStatusResponse
    """ # noqa: E501
    effective_date: Optional[date] = Field(default=None, alias="effectiveDate")
    position: Optional[IdResponse] = None
    organization: Optional[IdResponse] = None
    location: Optional[IdResponse] = None
    sub_location: Optional[IdResponse] = Field(default=None, alias="subLocation")
    job_title: Optional[IdResponse] = Field(default=None, alias="jobTitle")
    job_level: Optional[IdResponse] = Field(default=None, alias="jobLevel")
    employment_type: Optional[IdResponse] = Field(default=None, alias="employmentType")
    operational_group: Optional[IdResponse] = Field(default=None, alias="operationalGroup")
    cost_center: Optional[IdResponse] = Field(default=None, alias="costCenter")
    company: Optional[IdResponse] = None
    contract_start: Optional[date] = Field(default=None, alias="contractStart")
    contract_end: Optional[date] = Field(default=None, alias="contractEnd")
    permanent_date: Optional[date] = Field(default=None, alias="permanentDate")
    __properties: ClassVar[List[str]] = ["effectiveDate", "position", "organization", "location", "subLocation", "jobTitle", "jobLevel", "employmentType", "operationalGroup", "costCenter", "company", "contractStart", "contractEnd", "permanentDate"]

    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 PayrollProcessSnapshotEmploymentStatusResponse 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 position
        if self.position:
            _dict['position'] = self.position.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 location
        if self.location:
            _dict['location'] = self.location.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 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 employment_type
        if self.employment_type:
            _dict['employmentType'] = self.employment_type.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 cost_center
        if self.cost_center:
            _dict['costCenter'] = self.cost_center.to_dict()
        # override the default output from pydantic by calling `to_dict()` of company
        if self.company:
            _dict['company'] = self.company.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "effectiveDate": obj.get("effectiveDate"),
            "position": IdResponse.from_dict(obj["position"]) if obj.get("position") is not None else None,
            "organization": IdResponse.from_dict(obj["organization"]) if obj.get("organization") is not None else None,
            "location": IdResponse.from_dict(obj["location"]) if obj.get("location") is not None else None,
            "subLocation": IdResponse.from_dict(obj["subLocation"]) if obj.get("subLocation") is not None else None,
            "jobTitle": IdResponse.from_dict(obj["jobTitle"]) if obj.get("jobTitle") is not None else None,
            "jobLevel": IdResponse.from_dict(obj["jobLevel"]) if obj.get("jobLevel") is not None else None,
            "employmentType": IdResponse.from_dict(obj["employmentType"]) if obj.get("employmentType") is not None else None,
            "operationalGroup": IdResponse.from_dict(obj["operationalGroup"]) if obj.get("operationalGroup") is not None else None,
            "costCenter": IdResponse.from_dict(obj["costCenter"]) if obj.get("costCenter") is not None else None,
            "company": IdResponse.from_dict(obj["company"]) if obj.get("company") is not None else None,
            "contractStart": obj.get("contractStart"),
            "contractEnd": obj.get("contractEnd"),
            "permanentDate": obj.get("permanentDate")
        })
        return _obj


