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


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


@_attrs_define
class PkgRoutesDealsListDealsFilters:
    """
    Attributes:
        client (list[str] | Unset):
        funnel (str | Unset):
        owner (list[str] | Unset):
        search (str | Unset):
        source (list[str] | Unset):
        stage (list[str] | Unset):
        status (list[str] | Unset):
        tags (list[str] | Unset):
        value (list[TypesListFilterData] | Unset):
    """

    client: list[str] | Unset = UNSET
    funnel: str | Unset = UNSET
    owner: list[str] | Unset = UNSET
    search: str | Unset = UNSET
    source: list[str] | Unset = UNSET
    stage: list[str] | Unset = UNSET
    status: list[str] | Unset = UNSET
    tags: list[str] | Unset = UNSET
    value: list[TypesListFilterData] | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        funnel = self.funnel

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

        search = self.search

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

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

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

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

        value: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.value, Unset):
            value = []
            for value_item_data in self.value:
                value_item = value_item_data.to_dict()
                value.append(value_item)

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if client is not UNSET:
            field_dict["client"] = client
        if funnel is not UNSET:
            field_dict["funnel"] = funnel
        if owner is not UNSET:
            field_dict["owner"] = owner
        if search is not UNSET:
            field_dict["search"] = search
        if source is not UNSET:
            field_dict["source"] = source
        if stage is not UNSET:
            field_dict["stage"] = stage
        if status is not UNSET:
            field_dict["status"] = status
        if tags is not UNSET:
            field_dict["tags"] = tags
        if value is not UNSET:
            field_dict["value"] = value

        return field_dict

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

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

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

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

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

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

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

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

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

        _value = d.pop("value", UNSET)
        value: list[TypesListFilterData] | Unset = UNSET
        if _value is not UNSET:
            value = []
            for value_item_data in _value:
                value_item = TypesListFilterData.from_dict(value_item_data)

                value.append(value_item)

        pkg_routes_deals_list_deals_filters = cls(
            client=client,
            funnel=funnel,
            owner=owner,
            search=search,
            source=source,
            stage=stage,
            status=status,
            tags=tags,
            value=value,
        )

        pkg_routes_deals_list_deals_filters.additional_properties = d
        return pkg_routes_deals_list_deals_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
