# 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 pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from openapi_client.models.country_response import CountryResponse
from openapi_client.models.education_level_response import EducationLevelResponse
from openapi_client.models.field_of_study_response import FieldOfStudyResponse
from openapi_client.models.institution_response import InstitutionResponse
from typing import Optional, Set
from typing_extensions import Self

class EducationResponse(BaseModel):
    """
    EducationResponse
    """ # noqa: E501
    id: Optional[StrictStr] = None
    education_level: Optional[EducationLevelResponse] = Field(default=None, alias="educationLevel")
    field_of_study: Optional[FieldOfStudyResponse] = Field(default=None, alias="fieldOfStudy")
    country: Optional[CountryResponse] = None
    institution: Optional[InstitutionResponse] = None
    start_date: Optional[StrictStr] = Field(default=None, alias="startDate")
    graduation_date: Optional[StrictStr] = Field(default=None, alias="graduationDate")
    created_by: Optional[StrictStr] = Field(default=None, alias="createdBy")
    created_date: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="createdDate")
    updated_by: Optional[StrictStr] = Field(default=None, alias="updatedBy")
    updated_date: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="updatedDate")
    __properties: ClassVar[List[str]] = ["id", "educationLevel", "fieldOfStudy", "country", "institution", "startDate", "graduationDate", "createdBy", "createdDate", "updatedBy", "updatedDate"]

    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 EducationResponse 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 education_level
        if self.education_level:
            _dict['educationLevel'] = self.education_level.to_dict()
        # override the default output from pydantic by calling `to_dict()` of field_of_study
        if self.field_of_study:
            _dict['fieldOfStudy'] = self.field_of_study.to_dict()
        # override the default output from pydantic by calling `to_dict()` of country
        if self.country:
            _dict['country'] = self.country.to_dict()
        # override the default output from pydantic by calling `to_dict()` of institution
        if self.institution:
            _dict['institution'] = self.institution.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of EducationResponse 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"),
            "educationLevel": EducationLevelResponse.from_dict(obj["educationLevel"]) if obj.get("educationLevel") is not None else None,
            "fieldOfStudy": FieldOfStudyResponse.from_dict(obj["fieldOfStudy"]) if obj.get("fieldOfStudy") is not None else None,
            "country": CountryResponse.from_dict(obj["country"]) if obj.get("country") is not None else None,
            "institution": InstitutionResponse.from_dict(obj["institution"]) if obj.get("institution") is not None else None,
            "startDate": obj.get("startDate"),
            "graduationDate": obj.get("graduationDate"),
            "createdBy": obj.get("createdBy"),
            "createdDate": obj.get("createdDate"),
            "updatedBy": obj.get("updatedBy"),
            "updatedDate": obj.get("updatedDate")
        })
        return _obj


