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


@_attrs_define
class PkgRoutesContactsListContactsFilters:
    """
    Attributes:
        client (list[str] | Unset):
        company (list[str] | Unset):
        contact_type (list[str] | Unset):
        data (list[TypesListFilterData] | Unset):
        plan (list[str] | Unset):
        role (list[str] | Unset):
        search (str | Unset):
        state (list[str] | Unset):
        status (list[str] | Unset):
        tags (list[str] | Unset):
    """

    client: list[str] | Unset = UNSET
    company: list[str] | Unset = UNSET
    contact_type: list[str] | Unset = UNSET
    data: list[TypesListFilterData] | Unset = UNSET
    plan: list[str] | Unset = UNSET
    role: list[str] | Unset = UNSET
    search: str | Unset = UNSET
    state: list[str] | Unset = UNSET
    status: list[str] | Unset = UNSET
    tags: list[str] | 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

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

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

        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)

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

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

        search = self.search

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

        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

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if client is not UNSET:
            field_dict["client"] = client
        if company is not UNSET:
            field_dict["company"] = company
        if contact_type is not UNSET:
            field_dict["contact_type"] = contact_type
        if data is not UNSET:
            field_dict["data"] = data
        if plan is not UNSET:
            field_dict["plan"] = plan
        if role is not UNSET:
            field_dict["role"] = role
        if search is not UNSET:
            field_dict["search"] = search
        if state is not UNSET:
            field_dict["state"] = state
        if status is not UNSET:
            field_dict["status"] = status
        if tags is not UNSET:
            field_dict["tags"] = tags

        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))

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

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

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

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

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

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

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

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

        pkg_routes_contacts_list_contacts_filters = cls(
            client=client,
            company=company,
            contact_type=contact_type,
            data=data,
            plan=plan,
            role=role,
            search=search,
            state=state,
            status=status,
            tags=tags,
        )

        pkg_routes_contacts_list_contacts_filters.additional_properties = d
        return pkg_routes_contacts_list_contacts_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
