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_packages_retirement_plans_list_plans_filters_provisions import (
        PkgRoutesPackagesRetirementPlansListPlansFiltersProvisions,
    )
    from ..models.types_list_filter_data import TypesListFilterData


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


@_attrs_define
class PkgRoutesPackagesRetirementPlansListPlansFilters:
    """
    Attributes:
        admin_status (list[str] | Unset): MUST have both this, and PlanYear to filter by admin status...
        assignee (list[str] | Unset):
        client (list[str] | Unset):
        compliance_status (list[str] | Unset):
        data (list[TypesListFilterData] | Unset):
        include_joinders (bool | Unset):
        parent_plan (str | Unset):
        plan_structure (list[str] | Unset):
        plan_year (list[int] | Unset):
        provisions (PkgRoutesPackagesRetirementPlansListPlansFiltersProvisions | Unset):
        pye (Any | Unset):
        record_keeper (list[str] | Unset):
        search (str | Unset):
        status (list[str] | Unset):
        tags (list[str] | Unset):
        type_ (list[str] | Unset):
    """

    admin_status: list[str] | Unset = UNSET
    assignee: list[str] | Unset = UNSET
    client: list[str] | Unset = UNSET
    compliance_status: list[str] | Unset = UNSET
    data: list[TypesListFilterData] | Unset = UNSET
    include_joinders: bool | Unset = UNSET
    parent_plan: str | Unset = UNSET
    plan_structure: list[str] | Unset = UNSET
    plan_year: list[int] | Unset = UNSET
    provisions: PkgRoutesPackagesRetirementPlansListPlansFiltersProvisions | Unset = UNSET
    pye: Any | Unset = UNSET
    record_keeper: list[str] | Unset = UNSET
    search: str | Unset = UNSET
    status: list[str] | Unset = UNSET
    tags: list[str] | 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]:
        admin_status: list[str] | Unset = UNSET
        if not isinstance(self.admin_status, Unset):
            admin_status = self.admin_status

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

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

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

        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)

        include_joinders = self.include_joinders

        parent_plan = self.parent_plan

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

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

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

        pye = self.pye

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

        search = self.search

        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

        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 admin_status is not UNSET:
            field_dict["admin_status"] = admin_status
        if assignee is not UNSET:
            field_dict["assignee"] = assignee
        if client is not UNSET:
            field_dict["client"] = client
        if compliance_status is not UNSET:
            field_dict["compliance_status"] = compliance_status
        if data is not UNSET:
            field_dict["data"] = data
        if include_joinders is not UNSET:
            field_dict["include_joinders"] = include_joinders
        if parent_plan is not UNSET:
            field_dict["parent_plan"] = parent_plan
        if plan_structure is not UNSET:
            field_dict["plan_structure"] = plan_structure
        if plan_year is not UNSET:
            field_dict["plan_year"] = plan_year
        if provisions is not UNSET:
            field_dict["provisions"] = provisions
        if pye is not UNSET:
            field_dict["pye"] = pye
        if record_keeper is not UNSET:
            field_dict["record_keeper"] = record_keeper
        if search is not UNSET:
            field_dict["search"] = search
        if status is not UNSET:
            field_dict["status"] = status
        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:
        from ..models.pkg_routes_packages_retirement_plans_list_plans_filters_provisions import (
            PkgRoutesPackagesRetirementPlansListPlansFiltersProvisions,
        )
        from ..models.types_list_filter_data import TypesListFilterData

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

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

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

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

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

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

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

        plan_year = cast(list[int], d.pop("plan_year", UNSET))

        _provisions = d.pop("provisions", UNSET)
        provisions: PkgRoutesPackagesRetirementPlansListPlansFiltersProvisions | Unset
        if isinstance(_provisions, Unset):
            provisions = UNSET
        else:
            provisions = PkgRoutesPackagesRetirementPlansListPlansFiltersProvisions.from_dict(_provisions)

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

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

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

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

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

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

        pkg_routes_packages_retirement_plans_list_plans_filters = cls(
            admin_status=admin_status,
            assignee=assignee,
            client=client,
            compliance_status=compliance_status,
            data=data,
            include_joinders=include_joinders,
            parent_plan=parent_plan,
            plan_structure=plan_structure,
            plan_year=plan_year,
            provisions=provisions,
            pye=pye,
            record_keeper=record_keeper,
            search=search,
            status=status,
            tags=tags,
            type_=type_,
        )

        pkg_routes_packages_retirement_plans_list_plans_filters.additional_properties = d
        return pkg_routes_packages_retirement_plans_list_plans_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
