from __future__ import annotations

from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

if TYPE_CHECKING:
    from ..models.types_money_type_dates import TypesMoneyTypeDates
    from ..models.types_money_type_floats import TypesMoneyTypeFloats
    from ..models.types_money_type_strings import TypesMoneyTypeStrings


T = TypeVar("T", bound="TypesVesting")


@_attrs_define
class TypesVesting:
    """
    Attributes:
        date (TypesMoneyTypeDates | Unset):
        historical_hos (float | Unset):
        nra (str | Unset): Normal Retirement Age Date
        nra_met (bool | Unset):
        status (TypesMoneyTypeStrings | Unset):
        vested (TypesMoneyTypeFloats | Unset):
        yos (int | Unset):
    """

    date: TypesMoneyTypeDates | Unset = UNSET
    historical_hos: float | Unset = UNSET
    nra: str | Unset = UNSET
    nra_met: bool | Unset = UNSET
    status: TypesMoneyTypeStrings | Unset = UNSET
    vested: TypesMoneyTypeFloats | Unset = UNSET
    yos: int | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        date: dict[str, Any] | Unset = UNSET
        if not isinstance(self.date, Unset):
            date = self.date.to_dict()

        historical_hos = self.historical_hos

        nra = self.nra

        nra_met = self.nra_met

        status: dict[str, Any] | Unset = UNSET
        if not isinstance(self.status, Unset):
            status = self.status.to_dict()

        vested: dict[str, Any] | Unset = UNSET
        if not isinstance(self.vested, Unset):
            vested = self.vested.to_dict()

        yos = self.yos

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if date is not UNSET:
            field_dict["date"] = date
        if historical_hos is not UNSET:
            field_dict["historical_hos"] = historical_hos
        if nra is not UNSET:
            field_dict["nra"] = nra
        if nra_met is not UNSET:
            field_dict["nra_met"] = nra_met
        if status is not UNSET:
            field_dict["status"] = status
        if vested is not UNSET:
            field_dict["vested"] = vested
        if yos is not UNSET:
            field_dict["yos"] = yos

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.types_money_type_dates import TypesMoneyTypeDates
        from ..models.types_money_type_floats import TypesMoneyTypeFloats
        from ..models.types_money_type_strings import TypesMoneyTypeStrings

        d = dict(src_dict)
        _date = d.pop("date", UNSET)
        date: TypesMoneyTypeDates | Unset
        if isinstance(_date, Unset):
            date = UNSET
        else:
            date = TypesMoneyTypeDates.from_dict(_date)

        historical_hos = d.pop("historical_hos", UNSET)

        nra = d.pop("nra", UNSET)

        nra_met = d.pop("nra_met", UNSET)

        _status = d.pop("status", UNSET)
        status: TypesMoneyTypeStrings | Unset
        if isinstance(_status, Unset):
            status = UNSET
        else:
            status = TypesMoneyTypeStrings.from_dict(_status)

        _vested = d.pop("vested", UNSET)
        vested: TypesMoneyTypeFloats | Unset
        if isinstance(_vested, Unset):
            vested = UNSET
        else:
            vested = TypesMoneyTypeFloats.from_dict(_vested)

        yos = d.pop("yos", UNSET)

        types_vesting = cls(
            date=date,
            historical_hos=historical_hos,
            nra=nra,
            nra_met=nra_met,
            status=status,
            vested=vested,
            yos=yos,
        )

        types_vesting.additional_properties = d
        return types_vesting

    @property
    def additional_keys(self) -> list[str]:
        return list(self.additional_properties.keys())

    def __getitem__(self, key: str) -> Any:
        return self.additional_properties[key]

    def __setitem__(self, key: str, value: Any) -> None:
        self.additional_properties[key] = value

    def __delitem__(self, key: str) -> None:
        del self.additional_properties[key]

    def __contains__(self, key: str) -> bool:
        return key in self.additional_properties
