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


@_attrs_define
class TpaAccountCreateBody:
    """
    Attributes:
        plan_id (str): MongoDB ObjectId
        account_type (str | Unset):  Default: 'brokerage'.
        provider (str | Unset):
        number (str | Unset):
        payee (str | Unset):
        active (bool | Unset):
        internal_plan_id (str | Unset):
        pension_pro_id (float | Unset):
    """

    plan_id: str
    account_type: str | Unset = "brokerage"
    provider: str | Unset = UNSET
    number: str | Unset = UNSET
    payee: str | Unset = UNSET
    active: bool | Unset = UNSET
    internal_plan_id: str | Unset = UNSET
    pension_pro_id: float | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        account_type = self.account_type

        provider = self.provider

        number = self.number

        payee = self.payee

        active = self.active

        internal_plan_id = self.internal_plan_id

        pension_pro_id = self.pension_pro_id

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update(
            {
                "planId": plan_id,
            }
        )
        if account_type is not UNSET:
            field_dict["accountType"] = account_type
        if provider is not UNSET:
            field_dict["provider"] = provider
        if number is not UNSET:
            field_dict["number"] = number
        if payee is not UNSET:
            field_dict["payee"] = payee
        if active is not UNSET:
            field_dict["active"] = active
        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

        return field_dict

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

        account_type = d.pop("accountType", UNSET)

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

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

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

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

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

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

        tpa_account_create_body = cls(
            plan_id=plan_id,
            account_type=account_type,
            provider=provider,
            number=number,
            payee=payee,
            active=active,
            internal_plan_id=internal_plan_id,
            pension_pro_id=pension_pro_id,
        )

        tpa_account_create_body.additional_properties = d
        return tpa_account_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
