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


@_attrs_define
class TypesNotification:
    """
    Attributes:
        field_id (str | Unset):
        body (str | Unset):
        cleared_at (str | Unset):
        emailed_at (str | Unset):
        from_ (str | Unset):
        notified_at (str | Unset):
        team (str | Unset):
        type_ (str | Unset):
        url (str | Unset):
        user (str | Unset):
    """

    field_id: str | Unset = UNSET
    body: str | Unset = UNSET
    cleared_at: str | Unset = UNSET
    emailed_at: str | Unset = UNSET
    from_: str | Unset = UNSET
    notified_at: str | Unset = UNSET
    team: str | Unset = UNSET
    type_: str | Unset = UNSET
    url: str | Unset = UNSET
    user: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        body = self.body

        cleared_at = self.cleared_at

        emailed_at = self.emailed_at

        from_ = self.from_

        notified_at = self.notified_at

        team = self.team

        type_ = self.type_

        url = self.url

        user = self.user

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if field_id is not UNSET:
            field_dict["_id"] = field_id
        if body is not UNSET:
            field_dict["body"] = body
        if cleared_at is not UNSET:
            field_dict["cleared_at"] = cleared_at
        if emailed_at is not UNSET:
            field_dict["emailed_at"] = emailed_at
        if from_ is not UNSET:
            field_dict["from"] = from_
        if notified_at is not UNSET:
            field_dict["notified_at"] = notified_at
        if team is not UNSET:
            field_dict["team"] = team
        if type_ is not UNSET:
            field_dict["type"] = type_
        if url is not UNSET:
            field_dict["url"] = url
        if user is not UNSET:
            field_dict["user"] = user

        return field_dict

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

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

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

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

        from_ = d.pop("from", UNSET)

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

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

        type_ = d.pop("type", UNSET)

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

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

        types_notification = cls(
            field_id=field_id,
            body=body,
            cleared_at=cleared_at,
            emailed_at=emailed_at,
            from_=from_,
            notified_at=notified_at,
            team=team,
            type_=type_,
            url=url,
            user=user,
        )

        types_notification.additional_properties = d
        return types_notification

    @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
