from __future__ import annotations

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

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_list_filter_date import TypesListFilterDate


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


@_attrs_define
class PkgRoutesInboxListThreadsFilters:
    """
    Attributes:
        archive (bool | Unset):
        attachments (bool | Unset):
        bookmarked (bool | Unset):
        client (list[str] | Unset):
        date (TypesListFilterDate | Unset):
        from_ (list[str] | Unset):
        importance (list[int] | Unset):
        internal (bool | Unset):
        outbox (bool | Unset):
        search (str | Unset):
        sent (bool | Unset):
        tags (list[str] | Unset):
        to (list[str] | Unset):
    """

    archive: bool | Unset = UNSET
    attachments: bool | Unset = UNSET
    bookmarked: bool | Unset = UNSET
    client: list[str] | Unset = UNSET
    date: TypesListFilterDate | Unset = UNSET
    from_: list[str] | Unset = UNSET
    importance: list[int] | Unset = UNSET
    internal: bool | Unset = UNSET
    outbox: bool | Unset = UNSET
    search: str | Unset = UNSET
    sent: bool | Unset = UNSET
    tags: list[str] | Unset = UNSET
    to: list[str] | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        attachments = self.attachments

        bookmarked = self.bookmarked

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

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

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

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

        internal = self.internal

        outbox = self.outbox

        search = self.search

        sent = self.sent

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

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

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if archive is not UNSET:
            field_dict["archive"] = archive
        if attachments is not UNSET:
            field_dict["attachments"] = attachments
        if bookmarked is not UNSET:
            field_dict["bookmarked"] = bookmarked
        if client is not UNSET:
            field_dict["client"] = client
        if date is not UNSET:
            field_dict["date"] = date
        if from_ is not UNSET:
            field_dict["from"] = from_
        if importance is not UNSET:
            field_dict["importance"] = importance
        if internal is not UNSET:
            field_dict["internal"] = internal
        if outbox is not UNSET:
            field_dict["outbox"] = outbox
        if search is not UNSET:
            field_dict["search"] = search
        if sent is not UNSET:
            field_dict["sent"] = sent
        if tags is not UNSET:
            field_dict["tags"] = tags
        if to is not UNSET:
            field_dict["to"] = to

        return field_dict

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

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

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

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

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

        _date = d.pop("date", UNSET)
        date: TypesListFilterDate | Unset
        if isinstance(_date, Unset):
            date = UNSET
        else:
            date = TypesListFilterDate.from_dict(_date)

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

        importance = cast(list[int], d.pop("importance", UNSET))

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

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

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

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

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

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

        pkg_routes_inbox_list_threads_filters = cls(
            archive=archive,
            attachments=attachments,
            bookmarked=bookmarked,
            client=client,
            date=date,
            from_=from_,
            importance=importance,
            internal=internal,
            outbox=outbox,
            search=search,
            sent=sent,
            tags=tags,
            to=to,
        )

        pkg_routes_inbox_list_threads_filters.additional_properties = d
        return pkg_routes_inbox_list_threads_filters

    @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
