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


@_attrs_define
class TpaPlanCreateBody:
    """
    Attributes:
        plan_name (str):
        plan_type (str | Unset):
        internal_plan_id (str | Unset):
        pension_pro_id (float | Unset):
        end_mm (float | Unset):
        end_dd (float | Unset):
        active (bool | Unset):
        directory (str | Unset):
    """

    plan_name: str
    plan_type: str | Unset = UNSET
    internal_plan_id: str | Unset = UNSET
    pension_pro_id: float | Unset = UNSET
    end_mm: float | Unset = UNSET
    end_dd: float | Unset = UNSET
    active: bool | Unset = UNSET
    directory: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        plan_type = self.plan_type

        internal_plan_id = self.internal_plan_id

        pension_pro_id = self.pension_pro_id

        end_mm = self.end_mm

        end_dd = self.end_dd

        active = self.active

        directory = self.directory

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update(
            {
                "planName": plan_name,
            }
        )
        if plan_type is not UNSET:
            field_dict["planType"] = plan_type
        if internal_plan_id is not UNSET:
            field_dict["internalPlanId"] = internal_plan_id
        if pension_pro_id is not UNSET:
            field_dict["pensionProId"] = pension_pro_id
        if end_mm is not UNSET:
            field_dict["endMm"] = end_mm
        if end_dd is not UNSET:
            field_dict["endDd"] = end_dd
        if active is not UNSET:
            field_dict["active"] = active
        if directory is not UNSET:
            field_dict["directory"] = directory

        return field_dict

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

        plan_type = d.pop("planType", UNSET)

        internal_plan_id = d.pop("internalPlanId", UNSET)

        pension_pro_id = d.pop("pensionProId", UNSET)

        end_mm = d.pop("endMm", UNSET)

        end_dd = d.pop("endDd", UNSET)

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

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

        tpa_plan_create_body = cls(
            plan_name=plan_name,
            plan_type=plan_type,
            internal_plan_id=internal_plan_id,
            pension_pro_id=pension_pro_id,
            end_mm=end_mm,
            end_dd=end_dd,
            active=active,
            directory=directory,
        )

        tpa_plan_create_body.additional_properties = d
        return tpa_plan_create_body

    @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
