from __future__ import annotations

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

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_filters_client import TypesFiltersClient
    from ..models.types_filters_message import TypesFiltersMessage
    from ..models.types_filters_plan import TypesFiltersPlan
    from ..models.types_filters_project import TypesFiltersProject
    from ..models.types_filters_task import TypesFiltersTask


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


@_attrs_define
class TypesFilters:
    """
    Attributes:
        client (TypesFiltersClient | Unset):
        message (TypesFiltersMessage | Unset):
        plan (TypesFiltersPlan | Unset):
        project (TypesFiltersProject | Unset):
        task (TypesFiltersTask | Unset):
    """

    client: TypesFiltersClient | Unset = UNSET
    message: TypesFiltersMessage | Unset = UNSET
    plan: TypesFiltersPlan | Unset = UNSET
    project: TypesFiltersProject | Unset = UNSET
    task: TypesFiltersTask | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        client: dict[str, Any] | Unset = UNSET
        if not isinstance(self.client, Unset):
            client = self.client.to_dict()

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

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

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

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

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if client is not UNSET:
            field_dict["client"] = client
        if message is not UNSET:
            field_dict["message"] = message
        if plan is not UNSET:
            field_dict["plan"] = plan
        if project is not UNSET:
            field_dict["project"] = project
        if task is not UNSET:
            field_dict["task"] = task

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.types_filters_client import TypesFiltersClient
        from ..models.types_filters_message import TypesFiltersMessage
        from ..models.types_filters_plan import TypesFiltersPlan
        from ..models.types_filters_project import TypesFiltersProject
        from ..models.types_filters_task import TypesFiltersTask

        d = dict(src_dict)
        _client = d.pop("client", UNSET)
        client: TypesFiltersClient | Unset
        if isinstance(_client, Unset):
            client = UNSET
        else:
            client = TypesFiltersClient.from_dict(_client)

        _message = d.pop("message", UNSET)
        message: TypesFiltersMessage | Unset
        if isinstance(_message, Unset):
            message = UNSET
        else:
            message = TypesFiltersMessage.from_dict(_message)

        _plan = d.pop("plan", UNSET)
        plan: TypesFiltersPlan | Unset
        if isinstance(_plan, Unset):
            plan = UNSET
        else:
            plan = TypesFiltersPlan.from_dict(_plan)

        _project = d.pop("project", UNSET)
        project: TypesFiltersProject | Unset
        if isinstance(_project, Unset):
            project = UNSET
        else:
            project = TypesFiltersProject.from_dict(_project)

        _task = d.pop("task", UNSET)
        task: TypesFiltersTask | Unset
        if isinstance(_task, Unset):
            task = UNSET
        else:
            task = TypesFiltersTask.from_dict(_task)

        types_filters = cls(
            client=client,
            message=message,
            plan=plan,
            project=project,
            task=task,
        )

        types_filters.additional_properties = d
        return types_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
