from __future__ import annotations

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

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

from ..types import UNSET, Unset

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


@_attrs_define
class TypesMoneyTypeFloats:
    """
    Attributes:
        ee (float | Unset):
        er (float | Unset):
        er_match (float | Unset):
        er_non_elective (float | Unset):
        er_safe_harbor (float | Unset):
    """

    ee: float | Unset = UNSET
    er: float | Unset = UNSET
    er_match: float | Unset = UNSET
    er_non_elective: float | Unset = UNSET
    er_safe_harbor: float | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        er = self.er

        er_match = self.er_match

        er_non_elective = self.er_non_elective

        er_safe_harbor = self.er_safe_harbor

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if ee is not UNSET:
            field_dict["ee"] = ee
        if er is not UNSET:
            field_dict["er"] = er
        if er_match is not UNSET:
            field_dict["er_match"] = er_match
        if er_non_elective is not UNSET:
            field_dict["er_non_elective"] = er_non_elective
        if er_safe_harbor is not UNSET:
            field_dict["er_safe_harbor"] = er_safe_harbor

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        d = dict(src_dict)
        ee = d.pop("ee", UNSET)

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

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

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

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

        types_money_type_floats = cls(
            ee=ee,
            er=er,
            er_match=er_match,
            er_non_elective=er_non_elective,
            er_safe_harbor=er_safe_harbor,
        )

        types_money_type_floats.additional_properties = d
        return types_money_type_floats

    @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
