# 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, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self

class EmploymentDataRequest(BaseModel):
    """
    EmploymentDataRequest
    """ # noqa: E501
    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")
    effective_date: date = Field(description="YYYY-MM-DD", alias="effectiveDate")
    employment_status_number: Annotated[str, Field(strict=True, max_length=255)] = Field(alias="employmentStatusNumber")
    employment_status_type_id: StrictStr = Field(alias="employmentStatusTypeId")
    employment_type_id: StrictStr = Field(alias="employmentTypeId")
    job_level_id: StrictStr = Field(alias="jobLevelId")
    job_title_id: StrictStr = Field(alias="jobTitleId")
    location_id: StrictStr = Field(alias="locationId")
    organization_id: StrictStr = Field(alias="organizationId")
    cost_center_id: Optional[StrictStr] = Field(default=None, alias="costCenterId")
    permanent_date: Optional[date] = Field(default=None, description="YYYY-MM-DD", alias="permanentDate")
    sign_date: date = Field(description="YYYY-MM-DD", alias="signDate")
    generate_employment_status_number: Optional[StrictBool] = Field(default=False, alias="generateEmploymentStatusNumber")
    sub_location_id: Optional[StrictStr] = Field(default=None, alias="subLocationId")
    operational_group_id: Optional[StrictStr] = Field(default=None, alias="operationalGroupId")
    __properties: ClassVar[List[str]] = ["contractStart", "contractEnd", "effectiveDate", "employmentStatusNumber", "employmentStatusTypeId", "employmentTypeId", "jobLevelId", "jobTitleId", "locationId", "organizationId", "costCenterId", "permanentDate", "signDate", "generateEmploymentStatusNumber", "subLocationId", "operationalGroupId"]

    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 EmploymentDataRequest 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,
        )
        # set to None if contract_start (nullable) is None
        # and model_fields_set contains the field
        if self.contract_start is None and "contract_start" in self.model_fields_set:
            _dict['contractStart'] = None

        # set to None if contract_end (nullable) is None
        # and model_fields_set contains the field
        if self.contract_end is None and "contract_end" in self.model_fields_set:
            _dict['contractEnd'] = None

        # set to None if cost_center_id (nullable) is None
        # and model_fields_set contains the field
        if self.cost_center_id is None and "cost_center_id" in self.model_fields_set:
            _dict['costCenterId'] = None

        # set to None if permanent_date (nullable) is None
        # and model_fields_set contains the field
        if self.permanent_date is None and "permanent_date" in self.model_fields_set:
            _dict['permanentDate'] = None

        # set to None if sub_location_id (nullable) is None
        # and model_fields_set contains the field
        if self.sub_location_id is None and "sub_location_id" in self.model_fields_set:
            _dict['subLocationId'] = None

        # set to None if operational_group_id (nullable) is None
        # and model_fields_set contains the field
        if self.operational_group_id is None and "operational_group_id" in self.model_fields_set:
            _dict['operationalGroupId'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "contractStart": obj.get("contractStart"),
            "contractEnd": obj.get("contractEnd"),
            "effectiveDate": obj.get("effectiveDate"),
            "employmentStatusNumber": obj.get("employmentStatusNumber"),
            "employmentStatusTypeId": obj.get("employmentStatusTypeId"),
            "employmentTypeId": obj.get("employmentTypeId"),
            "jobLevelId": obj.get("jobLevelId"),
            "jobTitleId": obj.get("jobTitleId"),
            "locationId": obj.get("locationId"),
            "organizationId": obj.get("organizationId"),
            "costCenterId": obj.get("costCenterId"),
            "permanentDate": obj.get("permanentDate"),
            "signDate": obj.get("signDate"),
            "generateEmploymentStatusNumber": obj.get("generateEmploymentStatusNumber") if obj.get("generateEmploymentStatusNumber") is not None else False,
            "subLocationId": obj.get("subLocationId"),
            "operationalGroupId": obj.get("operationalGroupId")
        })
        return _obj


