# 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, StrictFloat, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional, Union
from openapi_client.models.base_job_experience_response import BaseJobExperienceResponse
from openapi_client.models.job_experience_employee_response import JobExperienceEmployeeResponse
from typing import Optional, Set
from typing_extensions import Self

class JobExperienceApprovalResponse(BaseModel):
    """
    JobExperienceApprovalResponse
    """ # noqa: E501
    id: Optional[StrictStr] = None
    company_name: Optional[StrictStr] = Field(default=None, alias="companyName")
    job_title: Optional[StrictStr] = Field(default=None, alias="jobTitle")
    job_level: Optional[StrictStr] = Field(default=None, alias="jobLevel")
    start_date: Optional[date] = Field(default=None, alias="startDate")
    end_date: Optional[date] = Field(default=None, alias="endDate")
    company_business: Optional[StrictStr] = Field(default=None, alias="companyBusiness")
    termination_reason_input: Optional[StrictStr] = Field(default=None, alias="terminationReasonInput")
    company_location: Optional[StrictStr] = Field(default=None, alias="companyLocation")
    last_salary: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="lastSalary")
    employee: Optional[JobExperienceEmployeeResponse] = None
    references: Optional[List[StrictStr]] = None
    job_experience: Optional[BaseJobExperienceResponse] = Field(default=None, alias="jobExperience")
    approval_status: Optional[StrictStr] = Field(default=None, alias="approvalStatus")
    rejection_reason: Optional[StrictStr] = Field(default=None, alias="rejectionReason")
    action: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["id", "companyName", "jobTitle", "jobLevel", "startDate", "endDate", "companyBusiness", "terminationReasonInput", "companyLocation", "lastSalary", "employee", "references", "jobExperience", "approvalStatus", "rejectionReason", "action"]

    @field_validator('approval_status')
    def approval_status_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['APPROVED', 'REJECTED', 'OPEN', 'WAITING_FOR_APPROVAL']):
            raise ValueError("must be one of enum values ('APPROVED', 'REJECTED', 'OPEN', 'WAITING_FOR_APPROVAL')")
        return value

    @field_validator('action')
    def action_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['NONE', 'ADD', 'EDIT', 'DELETE', 'DELETE_ALL']):
            raise ValueError("must be one of enum values ('NONE', 'ADD', 'EDIT', 'DELETE', 'DELETE_ALL')")
        return value

    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 JobExperienceApprovalResponse 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 employee
        if self.employee:
            _dict['employee'] = self.employee.to_dict()
        # override the default output from pydantic by calling `to_dict()` of job_experience
        if self.job_experience:
            _dict['jobExperience'] = self.job_experience.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of JobExperienceApprovalResponse 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"),
            "companyName": obj.get("companyName"),
            "jobTitle": obj.get("jobTitle"),
            "jobLevel": obj.get("jobLevel"),
            "startDate": obj.get("startDate"),
            "endDate": obj.get("endDate"),
            "companyBusiness": obj.get("companyBusiness"),
            "terminationReasonInput": obj.get("terminationReasonInput"),
            "companyLocation": obj.get("companyLocation"),
            "lastSalary": obj.get("lastSalary"),
            "employee": JobExperienceEmployeeResponse.from_dict(obj["employee"]) if obj.get("employee") is not None else None,
            "references": obj.get("references"),
            "jobExperience": BaseJobExperienceResponse.from_dict(obj["jobExperience"]) if obj.get("jobExperience") is not None else None,
            "approvalStatus": obj.get("approvalStatus"),
            "rejectionReason": obj.get("rejectionReason"),
            "action": obj.get("action")
        })
        return _obj


