# 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, field_validator
from typing import Any, ClassVar, Dict, List, Optional, Union
from openapi_client.models.employee_simple_response import EmployeeSimpleResponse
from openapi_client.models.kpp_simple_response import KppSimpleResponse
from openapi_client.models.tax_and_allowance_response import TaxAndAllowanceResponse
from typing import Optional, Set
from typing_extensions import Self

class MonthlyTaxReportResponse(BaseModel):
    """
    MonthlyTaxReportResponse
    """ # noqa: E501
    id: Optional[StrictStr] = None
    year: Optional[Union[StrictFloat, StrictInt]] = None
    month: Optional[Union[StrictFloat, StrictInt]] = None
    pph21_method: Optional[StrictStr] = Field(default=None, alias="pph21Method")
    membership_number: Optional[StrictStr] = Field(default=None, alias="membershipNumber")
    membership_address: Optional[StrictStr] = Field(default=None, alias="membershipAddress")
    total_monthly_gross_income: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="totalMonthlyGrossIncome")
    total_tax_and_allowance: Optional[TaxAndAllowanceResponse] = Field(default=None, alias="totalTaxAndAllowance")
    paid_tax_and_allowance: Optional[TaxAndAllowanceResponse] = Field(default=None, alias="paidTaxAndAllowance")
    tax_object: Optional[StrictStr] = Field(default=None, alias="taxObject")
    sequence_number: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="sequenceNumber")
    migrated: Optional[StrictBool] = None
    employee: Optional[EmployeeSimpleResponse] = None
    kpp: Optional[KppSimpleResponse] = None
    __properties: ClassVar[List[str]] = ["id", "year", "month", "pph21Method", "membershipNumber", "membershipAddress", "totalMonthlyGrossIncome", "totalTaxAndAllowance", "paidTaxAndAllowance", "taxObject", "sequenceNumber", "migrated", "employee", "kpp"]

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

        if value not in set(['PERMANENT', 'TEMPORARY', 'MULTI_LEVEL_DISTRIBUTOR', 'INSURANCE_AGENT', 'MERCHANT_GOODS', 'EXPERT_CONTINUOUS', 'EXPERT_NON_CONTINUOUS', 'CONTINUOUS', 'NON_CONTINUOUS', 'COMMISSIONER', 'FORMER_EMPLOYEE', 'EVENT_PARTICIPANT', 'EXPATRIATE', 'EXPERT', 'MEETING_PARTICIPANT', 'COMMITTEE_PARTICIPANT', 'EDUCATION_PARTICIPANT', 'OTHER_PARTICIPANT', 'ADVISOR_LECTURER', 'AUTHOR_RESEARCHER', 'SERVICE_PROVIDER', 'ADVERTISING_AGENT', 'PROJECT_MANAGER', 'INTERMEDIARY', 'ARTIST', 'ATHLETE', 'TEMPORARY_MONTHLY', 'COMPETITION_PARTICIPANT']):
            raise ValueError("must be one of enum values ('PERMANENT', 'TEMPORARY', 'MULTI_LEVEL_DISTRIBUTOR', 'INSURANCE_AGENT', 'MERCHANT_GOODS', 'EXPERT_CONTINUOUS', 'EXPERT_NON_CONTINUOUS', 'CONTINUOUS', 'NON_CONTINUOUS', 'COMMISSIONER', 'FORMER_EMPLOYEE', 'EVENT_PARTICIPANT', 'EXPATRIATE', 'EXPERT', 'MEETING_PARTICIPANT', 'COMMITTEE_PARTICIPANT', 'EDUCATION_PARTICIPANT', 'OTHER_PARTICIPANT', 'ADVISOR_LECTURER', 'AUTHOR_RESEARCHER', 'SERVICE_PROVIDER', 'ADVERTISING_AGENT', 'PROJECT_MANAGER', 'INTERMEDIARY', 'ARTIST', 'ATHLETE', 'TEMPORARY_MONTHLY', 'COMPETITION_PARTICIPANT')")
        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 MonthlyTaxReportResponse 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 total_tax_and_allowance
        if self.total_tax_and_allowance:
            _dict['totalTaxAndAllowance'] = self.total_tax_and_allowance.to_dict()
        # override the default output from pydantic by calling `to_dict()` of paid_tax_and_allowance
        if self.paid_tax_and_allowance:
            _dict['paidTaxAndAllowance'] = self.paid_tax_and_allowance.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 kpp
        if self.kpp:
            _dict['kpp'] = self.kpp.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of MonthlyTaxReportResponse 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"),
            "year": obj.get("year"),
            "month": obj.get("month"),
            "pph21Method": obj.get("pph21Method"),
            "membershipNumber": obj.get("membershipNumber"),
            "membershipAddress": obj.get("membershipAddress"),
            "totalMonthlyGrossIncome": obj.get("totalMonthlyGrossIncome"),
            "totalTaxAndAllowance": TaxAndAllowanceResponse.from_dict(obj["totalTaxAndAllowance"]) if obj.get("totalTaxAndAllowance") is not None else None,
            "paidTaxAndAllowance": TaxAndAllowanceResponse.from_dict(obj["paidTaxAndAllowance"]) if obj.get("paidTaxAndAllowance") is not None else None,
            "taxObject": obj.get("taxObject"),
            "sequenceNumber": obj.get("sequenceNumber"),
            "migrated": obj.get("migrated"),
            "employee": EmployeeSimpleResponse.from_dict(obj["employee"]) if obj.get("employee") is not None else None,
            "kpp": KppSimpleResponse.from_dict(obj["kpp"]) if obj.get("kpp") is not None else None
        })
        return _obj


