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_basis import TypesMoneyTypeBasis
    from ..models.types_money_type_basis_dates import TypesMoneyTypeBasisDates


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


@_attrs_define
class TypesVestingBasis:
    """
    Attributes:
        date_basis (TypesMoneyTypeBasisDates | Unset):
        pct_basis (TypesMoneyTypeBasis | Unset):
        yos_basis (TypesMoneyTypeBasis | Unset):
    """

    date_basis: TypesMoneyTypeBasisDates | Unset = UNSET
    pct_basis: TypesMoneyTypeBasis | Unset = UNSET
    yos_basis: TypesMoneyTypeBasis | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

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

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

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if date_basis is not UNSET:
            field_dict["date_basis"] = date_basis
        if pct_basis is not UNSET:
            field_dict["pct_basis"] = pct_basis
        if yos_basis is not UNSET:
            field_dict["yos_basis"] = yos_basis

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.types_money_type_basis import TypesMoneyTypeBasis
        from ..models.types_money_type_basis_dates import TypesMoneyTypeBasisDates

        d = dict(src_dict)
        _date_basis = d.pop("date_basis", UNSET)
        date_basis: TypesMoneyTypeBasisDates | Unset
        if isinstance(_date_basis, Unset):
            date_basis = UNSET
        else:
            date_basis = TypesMoneyTypeBasisDates.from_dict(_date_basis)

        _pct_basis = d.pop("pct_basis", UNSET)
        pct_basis: TypesMoneyTypeBasis | Unset
        if isinstance(_pct_basis, Unset):
            pct_basis = UNSET
        else:
            pct_basis = TypesMoneyTypeBasis.from_dict(_pct_basis)

        _yos_basis = d.pop("yos_basis", UNSET)
        yos_basis: TypesMoneyTypeBasis | Unset
        if isinstance(_yos_basis, Unset):
            yos_basis = UNSET
        else:
            yos_basis = TypesMoneyTypeBasis.from_dict(_yos_basis)

        types_vesting_basis = cls(
            date_basis=date_basis,
            pct_basis=pct_basis,
            yos_basis=yos_basis,
        )

        types_vesting_basis.additional_properties = d
        return types_vesting_basis

    @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
