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


@_attrs_define
class PkgRoutesPackagesRetirementParticipantsListParticipantsFilters:
    """
    Attributes:
        amount (list[TypesListFilterData] | Unset):
        class_ (list[str] | Unset):
        error (list[str] | Unset):
        group (list[str] | Unset):
        search (str | Unset):
        show_terminated_employees (bool | Unset):
        status (list[str] | Unset):
    """

    amount: list[TypesListFilterData] | Unset = UNSET
    class_: list[str] | Unset = UNSET
    error: list[str] | Unset = UNSET
    group: list[str] | Unset = UNSET
    search: str | Unset = UNSET
    show_terminated_employees: bool | Unset = UNSET
    status: list[str] | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        amount: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.amount, Unset):
            amount = []
            for amount_item_data in self.amount:
                amount_item = amount_item_data.to_dict()
                amount.append(amount_item)

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

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

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

        search = self.search

        show_terminated_employees = self.show_terminated_employees

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

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if amount is not UNSET:
            field_dict["amount"] = amount
        if class_ is not UNSET:
            field_dict["class"] = class_
        if error is not UNSET:
            field_dict["error"] = error
        if group is not UNSET:
            field_dict["group"] = group
        if search is not UNSET:
            field_dict["search"] = search
        if show_terminated_employees is not UNSET:
            field_dict["show_terminated_employees"] = show_terminated_employees
        if status is not UNSET:
            field_dict["status"] = status

        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)
        _amount = d.pop("amount", UNSET)
        amount: list[TypesListFilterData] | Unset = UNSET
        if _amount is not UNSET:
            amount = []
            for amount_item_data in _amount:
                amount_item = TypesListFilterData.from_dict(amount_item_data)

                amount.append(amount_item)

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

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

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

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

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

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

        pkg_routes_packages_retirement_participants_list_participants_filters = cls(
            amount=amount,
            class_=class_,
            error=error,
            group=group,
            search=search,
            show_terminated_employees=show_terminated_employees,
            status=status,
        )

        pkg_routes_packages_retirement_participants_list_participants_filters.additional_properties = d
        return pkg_routes_packages_retirement_participants_list_participants_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
