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


@_attrs_define
class TpaStatementAttachBody:
    """
    Attributes:
        doc_id (str): MongoDB ObjectId
        plan_id (str | Unset):
        account_number (str | Unset):
    """

    doc_id: str
    plan_id: str | Unset = UNSET
    account_number: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        plan_id = self.plan_id

        account_number = self.account_number

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update(
            {
                "docId": doc_id,
            }
        )
        if plan_id is not UNSET:
            field_dict["planId"] = plan_id
        if account_number is not UNSET:
            field_dict["accountNumber"] = account_number

        return field_dict

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

        plan_id = d.pop("planId", UNSET)

        account_number = d.pop("accountNumber", UNSET)

        tpa_statement_attach_body = cls(
            doc_id=doc_id,
            plan_id=plan_id,
            account_number=account_number,
        )

        tpa_statement_attach_body.additional_properties = d
        return tpa_statement_attach_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
