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_vesting_basis import TypesVestingBasis


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


@_attrs_define
class TypesEmployeePlanData:
    """
    Attributes:
        plan (str | Unset):
        vesting_basis (TypesVestingBasis | Unset):
    """

    plan: str | Unset = UNSET
    vesting_basis: TypesVestingBasis | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        plan = self.plan

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

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

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.types_vesting_basis import TypesVestingBasis

        d = dict(src_dict)
        plan = d.pop("plan", UNSET)

        _vesting_basis = d.pop("vesting_basis", UNSET)
        vesting_basis: TypesVestingBasis | Unset
        if isinstance(_vesting_basis, Unset):
            vesting_basis = UNSET
        else:
            vesting_basis = TypesVestingBasis.from_dict(_vesting_basis)

        types_employee_plan_data = cls(
            plan=plan,
            vesting_basis=vesting_basis,
        )

        types_employee_plan_data.additional_properties = d
        return types_employee_plan_data

    @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
