from __future__ import annotations

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

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

from ..types import UNSET, Unset

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


@_attrs_define
class PkgRoutesPackagesRetirementPlansJoinder:
    """
    Attributes:
        client (str | Unset):
        has_provisions (bool | Unset):
        name (str | Unset):
        payroll_provider (str | Unset):
        plan (str | Unset):
    """

    client: str | Unset = UNSET
    has_provisions: bool | Unset = UNSET
    name: str | Unset = UNSET
    payroll_provider: str | Unset = UNSET
    plan: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        client = self.client

        has_provisions = self.has_provisions

        name = self.name

        payroll_provider = self.payroll_provider

        plan = self.plan

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if client is not UNSET:
            field_dict["client"] = client
        if has_provisions is not UNSET:
            field_dict["has_provisions"] = has_provisions
        if name is not UNSET:
            field_dict["name"] = name
        if payroll_provider is not UNSET:
            field_dict["payroll_provider"] = payroll_provider
        if plan is not UNSET:
            field_dict["plan"] = plan

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        d = dict(src_dict)
        client = d.pop("client", UNSET)

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

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

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

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

        pkg_routes_packages_retirement_plans_joinder = cls(
            client=client,
            has_provisions=has_provisions,
            name=name,
            payroll_provider=payroll_provider,
            plan=plan,
        )

        pkg_routes_packages_retirement_plans_joinder.additional_properties = d
        return pkg_routes_packages_retirement_plans_joinder

    @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
