from __future__ import annotations

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

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

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


@_attrs_define
class RoutesDealsCampaignListcampaignsFilter:
    """
    Attributes:
        manager (list[str] | Unset):
        search (str | Unset):
        tags (list[str] | Unset):
        type_ (str | Unset):
    """

    manager: list[str] | Unset = UNSET
    search: str | Unset = UNSET
    tags: list[str] | Unset = UNSET
    type_: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        search = self.search

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

        type_ = self.type_

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if manager is not UNSET:
            field_dict["manager"] = manager
        if search is not UNSET:
            field_dict["search"] = search
        if tags is not UNSET:
            field_dict["tags"] = tags
        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:
        d = dict(src_dict)
        manager = cast(list[str], d.pop("manager", UNSET))

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

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

        type_ = d.pop("type", UNSET)

        routes_deals_campaign_listcampaigns_filter = cls(
            manager=manager,
            search=search,
            tags=tags,
            type_=type_,
        )

        routes_deals_campaign_listcampaigns_filter.additional_properties = d
        return routes_deals_campaign_listcampaigns_filter

    @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
