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.pkg_routes_library_forms_date_filter import PkgRoutesLibraryFormsDateFilter


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


@_attrs_define
class PkgRoutesLibraryFormsListResponseFilters:
    """
    Attributes:
        search (str | Unset):
        shared (PkgRoutesLibraryFormsDateFilter | Unset):
        started (PkgRoutesLibraryFormsDateFilter | Unset):
        status (list[str] | Unset):
        submitted (PkgRoutesLibraryFormsDateFilter | Unset):
        type_ (list[str] | Unset):
    """

    search: str | Unset = UNSET
    shared: PkgRoutesLibraryFormsDateFilter | Unset = UNSET
    started: PkgRoutesLibraryFormsDateFilter | Unset = UNSET
    status: list[str] | Unset = UNSET
    submitted: PkgRoutesLibraryFormsDateFilter | Unset = UNSET
    type_: list[str] | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

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

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

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

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

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

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if search is not UNSET:
            field_dict["search"] = search
        if shared is not UNSET:
            field_dict["shared"] = shared
        if started is not UNSET:
            field_dict["started"] = started
        if status is not UNSET:
            field_dict["status"] = status
        if submitted is not UNSET:
            field_dict["submitted"] = submitted
        if type_ is not UNSET:
            field_dict["type"] = type_

        return field_dict

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

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

        _shared = d.pop("shared", UNSET)
        shared: PkgRoutesLibraryFormsDateFilter | Unset
        if isinstance(_shared, Unset):
            shared = UNSET
        else:
            shared = PkgRoutesLibraryFormsDateFilter.from_dict(_shared)

        _started = d.pop("started", UNSET)
        started: PkgRoutesLibraryFormsDateFilter | Unset
        if isinstance(_started, Unset):
            started = UNSET
        else:
            started = PkgRoutesLibraryFormsDateFilter.from_dict(_started)

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

        _submitted = d.pop("submitted", UNSET)
        submitted: PkgRoutesLibraryFormsDateFilter | Unset
        if isinstance(_submitted, Unset):
            submitted = UNSET
        else:
            submitted = PkgRoutesLibraryFormsDateFilter.from_dict(_submitted)

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

        pkg_routes_library_forms_list_response_filters = cls(
            search=search,
            shared=shared,
            started=started,
            status=status,
            submitted=submitted,
            type_=type_,
        )

        pkg_routes_library_forms_list_response_filters.additional_properties = d
        return pkg_routes_library_forms_list_response_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
