# coding: utf-8

"""
    RentCast API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 1.0
    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
from typing import Any, ClassVar, Dict, List, Optional
from rentcast_client.models.property_records200_response_inner_tax_assessments2019 import PropertyRecords200ResponseInnerTaxAssessments2019
from rentcast_client.models.property_records200_response_inner_tax_assessments2020 import PropertyRecords200ResponseInnerTaxAssessments2020
from rentcast_client.models.property_records200_response_inner_tax_assessments2021 import PropertyRecords200ResponseInnerTaxAssessments2021
from rentcast_client.models.property_records200_response_inner_tax_assessments2022 import PropertyRecords200ResponseInnerTaxAssessments2022
from rentcast_client.models.property_records200_response_inner_tax_assessments2023 import PropertyRecords200ResponseInnerTaxAssessments2023
from typing import Optional, Set
from typing_extensions import Self

class PropertyRecords200ResponseInnerTaxAssessments(BaseModel):
    """
    PropertyRecords200ResponseInnerTaxAssessments
    """ # noqa: E501
    var_2019: Optional[PropertyRecords200ResponseInnerTaxAssessments2019] = Field(default=None, alias="2019")
    var_2020: Optional[PropertyRecords200ResponseInnerTaxAssessments2020] = Field(default=None, alias="2020")
    var_2021: Optional[PropertyRecords200ResponseInnerTaxAssessments2021] = Field(default=None, alias="2021")
    var_2022: Optional[PropertyRecords200ResponseInnerTaxAssessments2022] = Field(default=None, alias="2022")
    var_2023: Optional[PropertyRecords200ResponseInnerTaxAssessments2023] = Field(default=None, alias="2023")
    __properties: ClassVar[List[str]] = ["2019", "2020", "2021", "2022", "2023"]

    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 PropertyRecords200ResponseInnerTaxAssessments 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 var_2019
        if self.var_2019:
            _dict['2019'] = self.var_2019.to_dict()
        # override the default output from pydantic by calling `to_dict()` of var_2020
        if self.var_2020:
            _dict['2020'] = self.var_2020.to_dict()
        # override the default output from pydantic by calling `to_dict()` of var_2021
        if self.var_2021:
            _dict['2021'] = self.var_2021.to_dict()
        # override the default output from pydantic by calling `to_dict()` of var_2022
        if self.var_2022:
            _dict['2022'] = self.var_2022.to_dict()
        # override the default output from pydantic by calling `to_dict()` of var_2023
        if self.var_2023:
            _dict['2023'] = self.var_2023.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "2019": PropertyRecords200ResponseInnerTaxAssessments2019.from_dict(obj["2019"]) if obj.get("2019") is not None else None,
            "2020": PropertyRecords200ResponseInnerTaxAssessments2020.from_dict(obj["2020"]) if obj.get("2020") is not None else None,
            "2021": PropertyRecords200ResponseInnerTaxAssessments2021.from_dict(obj["2021"]) if obj.get("2021") is not None else None,
            "2022": PropertyRecords200ResponseInnerTaxAssessments2022.from_dict(obj["2022"]) if obj.get("2022") is not None else None,
            "2023": PropertyRecords200ResponseInnerTaxAssessments2023.from_dict(obj["2023"]) if obj.get("2023") is not None else None
        })
        return _obj


