# 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 pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from openapi_client.models.employee_simple_response import EmployeeSimpleResponse
from openapi_client.models.name_response import NameResponse
from openapi_client.models.transition_calculation_employee_salary_template_response import TransitionCalculationEmployeeSalaryTemplateResponse
from openapi_client.models.unprocessable_message import UnprocessableMessage
from typing import Optional, Set
from typing_extensions import Self

class ProcessedTransitionCalculationResponse(BaseModel):
    """
    ProcessedTransitionCalculationResponse
    """ # noqa: E501
    cost_center: Optional[NameResponse] = Field(default=None, alias="costCenter")
    employee: Optional[EmployeeSimpleResponse] = None
    employee_salary_template_history: Optional[TransitionCalculationEmployeeSalaryTemplateResponse] = Field(default=None, alias="employeeSalaryTemplateHistory")
    employee_workday: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="employeeWorkday")
    employment_type: Optional[NameResponse] = Field(default=None, alias="employmentType")
    end_date: Optional[StrictStr] = Field(default=None, alias="endDate")
    id: Optional[StrictStr] = None
    job_title: Optional[NameResponse] = Field(default=None, alias="jobTitle")
    location: Optional[NameResponse] = None
    messages: Optional[List[UnprocessableMessage]] = None
    normal_workday: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="normalWorkday")
    organization: Optional[NameResponse] = None
    payment_process: Optional[StrictBool] = Field(default=None, alias="paymentProcess")
    start_date: Optional[StrictStr] = Field(default=None, alias="startDate")
    total_thp: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="totalThp")
    __properties: ClassVar[List[str]] = ["costCenter", "employee", "employeeSalaryTemplateHistory", "employeeWorkday", "employmentType", "endDate", "id", "jobTitle", "location", "messages", "normalWorkday", "organization", "paymentProcess", "startDate", "totalThp"]

    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 ProcessedTransitionCalculationResponse 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 employee
        if self.employee:
            _dict['employee'] = self.employee.to_dict()
        # override the default output from pydantic by calling `to_dict()` of employee_salary_template_history
        if self.employee_salary_template_history:
            _dict['employeeSalaryTemplateHistory'] = self.employee_salary_template_history.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_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 each item in messages (list)
        _items = []
        if self.messages:
            for _item_messages in self.messages:
                if _item_messages:
                    _items.append(_item_messages.to_dict())
            _dict['messages'] = _items
        # override the default output from pydantic by calling `to_dict()` of organization
        if self.organization:
            _dict['organization'] = self.organization.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "costCenter": NameResponse.from_dict(obj["costCenter"]) if obj.get("costCenter") is not None else None,
            "employee": EmployeeSimpleResponse.from_dict(obj["employee"]) if obj.get("employee") is not None else None,
            "employeeSalaryTemplateHistory": TransitionCalculationEmployeeSalaryTemplateResponse.from_dict(obj["employeeSalaryTemplateHistory"]) if obj.get("employeeSalaryTemplateHistory") is not None else None,
            "employeeWorkday": obj.get("employeeWorkday"),
            "employmentType": NameResponse.from_dict(obj["employmentType"]) if obj.get("employmentType") is not None else None,
            "endDate": obj.get("endDate"),
            "id": obj.get("id"),
            "jobTitle": NameResponse.from_dict(obj["jobTitle"]) if obj.get("jobTitle") is not None else None,
            "location": NameResponse.from_dict(obj["location"]) if obj.get("location") is not None else None,
            "messages": [UnprocessableMessage.from_dict(_item) for _item in obj["messages"]] if obj.get("messages") is not None else None,
            "normalWorkday": obj.get("normalWorkday"),
            "organization": NameResponse.from_dict(obj["organization"]) if obj.get("organization") is not None else None,
            "paymentProcess": obj.get("paymentProcess"),
            "startDate": obj.get("startDate"),
            "totalThp": obj.get("totalThp")
        })
        return _obj


