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_data import TypesListFilterData
    from ..models.types_list_filter_date import TypesListFilterDate


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


@_attrs_define
class PkgRoutesTodoProjectListProjectsFilters:
    """
    Attributes:
        assignee (list[str] | Unset):
        client (list[str] | Unset):
        client_request (str | Unset):
        data (list[TypesListFilterData] | Unset):
        due (TypesListFilterDate | Unset):
        lead (list[str] | Unset):
        plan (list[str] | Unset):
        search (str | Unset):
        show_plan_year_detail (bool | Unset):
        status (str | Unset):
        tags (list[str] | Unset):
        template (list[str] | Unset):
    """

    assignee: list[str] | Unset = UNSET
    client: list[str] | Unset = UNSET
    client_request: str | Unset = UNSET
    data: list[TypesListFilterData] | Unset = UNSET
    due: TypesListFilterDate | Unset = UNSET
    lead: list[str] | Unset = UNSET
    plan: list[str] | Unset = UNSET
    search: str | Unset = UNSET
    show_plan_year_detail: bool | Unset = UNSET
    status: str | Unset = UNSET
    tags: list[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

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

        client_request = self.client_request

        data: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.data, Unset):
            data = []
            for data_item_data in self.data:
                data_item = data_item_data.to_dict()
                data.append(data_item)

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

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

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

        search = self.search

        show_plan_year_detail = self.show_plan_year_detail

        status = self.status

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

        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 client is not UNSET:
            field_dict["client"] = client
        if client_request is not UNSET:
            field_dict["client_request"] = client_request
        if data is not UNSET:
            field_dict["data"] = data
        if due is not UNSET:
            field_dict["due"] = due
        if lead is not UNSET:
            field_dict["lead"] = lead
        if plan is not UNSET:
            field_dict["plan"] = plan
        if search is not UNSET:
            field_dict["search"] = search
        if show_plan_year_detail is not UNSET:
            field_dict["showPlanYearDetail"] = show_plan_year_detail
        if status is not UNSET:
            field_dict["status"] = status
        if tags is not UNSET:
            field_dict["tags"] = tags
        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_data import TypesListFilterData
        from ..models.types_list_filter_date import TypesListFilterDate

        d = dict(src_dict)
        assignee = cast(list[str], d.pop("assignee", UNSET))

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

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

        _data = d.pop("data", UNSET)
        data: list[TypesListFilterData] | Unset = UNSET
        if _data is not UNSET:
            data = []
            for data_item_data in _data:
                data_item = TypesListFilterData.from_dict(data_item_data)

                data.append(data_item)

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

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

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

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

        show_plan_year_detail = d.pop("showPlanYearDetail", UNSET)

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

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

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

        pkg_routes_todo_project_list_projects_filters = cls(
            assignee=assignee,
            client=client,
            client_request=client_request,
            data=data,
            due=due,
            lead=lead,
            plan=plan,
            search=search,
            show_plan_year_detail=show_plan_year_detail,
            status=status,
            tags=tags,
            template=template,
        )

        pkg_routes_todo_project_list_projects_filters.additional_properties = d
        return pkg_routes_todo_project_list_projects_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
