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="LegacytypesPreferences")


@_attrs_define
class LegacytypesPreferences:
    """
    Attributes:
        email_on_assignments (bool | Unset):
        email_on_assists (bool | Unset):
        email_on_client_actions (bool | Unset):
        email_on_client_updates (bool | Unset):
        email_on_community (bool | Unset):
        email_on_mentions (bool | Unset):
        email_on_overdue (bool | Unset):
        email_on_shared_files (bool | Unset):
    """

    email_on_assignments: bool | Unset = UNSET
    email_on_assists: bool | Unset = UNSET
    email_on_client_actions: bool | Unset = UNSET
    email_on_client_updates: bool | Unset = UNSET
    email_on_community: bool | Unset = UNSET
    email_on_mentions: bool | Unset = UNSET
    email_on_overdue: bool | Unset = UNSET
    email_on_shared_files: bool | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        email_on_assists = self.email_on_assists

        email_on_client_actions = self.email_on_client_actions

        email_on_client_updates = self.email_on_client_updates

        email_on_community = self.email_on_community

        email_on_mentions = self.email_on_mentions

        email_on_overdue = self.email_on_overdue

        email_on_shared_files = self.email_on_shared_files

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if email_on_assignments is not UNSET:
            field_dict["email_on_assignments"] = email_on_assignments
        if email_on_assists is not UNSET:
            field_dict["email_on_assists"] = email_on_assists
        if email_on_client_actions is not UNSET:
            field_dict["email_on_client_actions"] = email_on_client_actions
        if email_on_client_updates is not UNSET:
            field_dict["email_on_client_updates"] = email_on_client_updates
        if email_on_community is not UNSET:
            field_dict["email_on_community"] = email_on_community
        if email_on_mentions is not UNSET:
            field_dict["email_on_mentions"] = email_on_mentions
        if email_on_overdue is not UNSET:
            field_dict["email_on_overdue"] = email_on_overdue
        if email_on_shared_files is not UNSET:
            field_dict["email_on_shared_files"] = email_on_shared_files

        return field_dict

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

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

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

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

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

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

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

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

        legacytypes_preferences = cls(
            email_on_assignments=email_on_assignments,
            email_on_assists=email_on_assists,
            email_on_client_actions=email_on_client_actions,
            email_on_client_updates=email_on_client_updates,
            email_on_community=email_on_community,
            email_on_mentions=email_on_mentions,
            email_on_overdue=email_on_overdue,
            email_on_shared_files=email_on_shared_files,
        )

        legacytypes_preferences.additional_properties = d
        return legacytypes_preferences

    @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
