from __future__ import annotations

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

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

from ..types import UNSET, Unset

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


@_attrs_define
class PkgRoutesDashboardClientEmail:
    """
    Attributes:
        field_id (str | Unset):
        clients (list[str] | Unset):
        date (str | Unset):
        from_ (str | Unset):
        requires_response (bool | Unset):
        sentiment (int | Unset):
        subject (str | Unset):
        thread (str | Unset):
    """

    field_id: str | Unset = UNSET
    clients: list[str] | Unset = UNSET
    date: str | Unset = UNSET
    from_: str | Unset = UNSET
    requires_response: bool | Unset = UNSET
    sentiment: int | Unset = UNSET
    subject: str | Unset = UNSET
    thread: 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

        clients: list[str] | Unset = UNSET
        if not isinstance(self.clients, Unset):
            clients = self.clients

        date = self.date

        from_ = self.from_

        requires_response = self.requires_response

        sentiment = self.sentiment

        subject = self.subject

        thread = self.thread

        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 clients is not UNSET:
            field_dict["clients"] = clients
        if date is not UNSET:
            field_dict["date"] = date
        if from_ is not UNSET:
            field_dict["from"] = from_
        if requires_response is not UNSET:
            field_dict["requires_response"] = requires_response
        if sentiment is not UNSET:
            field_dict["sentiment"] = sentiment
        if subject is not UNSET:
            field_dict["subject"] = subject
        if thread is not UNSET:
            field_dict["thread"] = thread

        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)

        clients = cast(list[str], d.pop("clients", UNSET))

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

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

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

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

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

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

        pkg_routes_dashboard_client_email = cls(
            field_id=field_id,
            clients=clients,
            date=date,
            from_=from_,
            requires_response=requires_response,
            sentiment=sentiment,
            subject=subject,
            thread=thread,
        )

        pkg_routes_dashboard_client_email.additional_properties = d
        return pkg_routes_dashboard_client_email

    @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
