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


@_attrs_define
class PkgRoutesTodoTaskListTasksFilters:
    """
    Attributes:
        assignee (list[str] | Unset):
        automation (list[str] | Unset):
        client (list[str] | Unset):
        client_task_type (list[str] | Unset):
        due (TypesListFilterDate | Unset):
        flagged (bool | Unset):
        internal_task_type (list[str] | Unset):
        plan (list[str] | Unset):
        priority (list[int] | Unset):
        project (list[str] | Unset):
        search (str | Unset):
        show_only_next (bool | Unset):
        status (str | Unset):
        template (list[str] | Unset):
    """

    assignee: list[str] | Unset = UNSET
    automation: list[str] | Unset = UNSET
    client: list[str] | Unset = UNSET
    client_task_type: list[str] | Unset = UNSET
    due: TypesListFilterDate | Unset = UNSET
    flagged: bool | Unset = UNSET
    internal_task_type: list[str] | Unset = UNSET
    plan: list[str] | Unset = UNSET
    priority: list[int] | Unset = UNSET
    project: list[str] | Unset = UNSET
    search: str | Unset = UNSET
    show_only_next: bool | Unset = UNSET
    status: str | Unset = UNSET
    template: list[str] | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

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

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

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

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

        flagged = self.flagged

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

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

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

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

        search = self.search

        show_only_next = self.show_only_next

        status = self.status

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

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if assignee is not UNSET:
            field_dict["assignee"] = assignee
        if automation is not UNSET:
            field_dict["automation"] = automation
        if client is not UNSET:
            field_dict["client"] = client
        if client_task_type is not UNSET:
            field_dict["client_task_type"] = client_task_type
        if due is not UNSET:
            field_dict["due"] = due
        if flagged is not UNSET:
            field_dict["flagged"] = flagged
        if internal_task_type is not UNSET:
            field_dict["internal_task_type"] = internal_task_type
        if plan is not UNSET:
            field_dict["plan"] = plan
        if priority is not UNSET:
            field_dict["priority"] = priority
        if project is not UNSET:
            field_dict["project"] = project
        if search is not UNSET:
            field_dict["search"] = search
        if show_only_next is not UNSET:
            field_dict["show_only_next"] = show_only_next
        if status is not UNSET:
            field_dict["status"] = status
        if template is not UNSET:
            field_dict["template"] = template

        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)
        assignee = cast(list[str], d.pop("assignee", UNSET))

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

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

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

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

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

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

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

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

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

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

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

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

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

        pkg_routes_todo_task_list_tasks_filters = cls(
            assignee=assignee,
            automation=automation,
            client=client,
            client_task_type=client_task_type,
            due=due,
            flagged=flagged,
            internal_task_type=internal_task_type,
            plan=plan,
            priority=priority,
            project=project,
            search=search,
            show_only_next=show_only_next,
            status=status,
            template=template,
        )

        pkg_routes_todo_task_list_tasks_filters.additional_properties = d
        return pkg_routes_todo_task_list_tasks_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
