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


@_attrs_define
class LegacytypesInvestmentAccount:
    """
    Attributes:
        field_id (str | Unset):
        closed_at (str | Unset):
        created_at (str | Unset):
        deleted_at (str | Unset):
        employee (str | Unset):
        format_ (str | Unset): Data extraction format
        name (str | Unset): Payee/FBO
        notes (str | Unset):
        number (str | Unset): Account details
        opened_at (str | Unset):
        plan (str | Unset):
        provider (str | Unset):
        remote_id (str | Unset):
        remote_source (str | Unset): Reference to external system
        status (str | Unset):
        team (str | Unset):
        type_ (str | Unset):
    """

    field_id: str | Unset = UNSET
    closed_at: str | Unset = UNSET
    created_at: str | Unset = UNSET
    deleted_at: str | Unset = UNSET
    employee: str | Unset = UNSET
    format_: str | Unset = UNSET
    name: str | Unset = UNSET
    notes: str | Unset = UNSET
    number: str | Unset = UNSET
    opened_at: str | Unset = UNSET
    plan: str | Unset = UNSET
    provider: str | Unset = UNSET
    remote_id: str | Unset = UNSET
    remote_source: str | Unset = UNSET
    status: str | Unset = UNSET
    team: str | Unset = UNSET
    type_: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        closed_at = self.closed_at

        created_at = self.created_at

        deleted_at = self.deleted_at

        employee = self.employee

        format_ = self.format_

        name = self.name

        notes = self.notes

        number = self.number

        opened_at = self.opened_at

        plan = self.plan

        provider = self.provider

        remote_id = self.remote_id

        remote_source = self.remote_source

        status = self.status

        team = self.team

        type_ = self.type_

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if field_id is not UNSET:
            field_dict["_id"] = field_id
        if closed_at is not UNSET:
            field_dict["closed_at"] = closed_at
        if created_at is not UNSET:
            field_dict["created_at"] = created_at
        if deleted_at is not UNSET:
            field_dict["deleted_at"] = deleted_at
        if employee is not UNSET:
            field_dict["employee"] = employee
        if format_ is not UNSET:
            field_dict["format"] = format_
        if name is not UNSET:
            field_dict["name"] = name
        if notes is not UNSET:
            field_dict["notes"] = notes
        if number is not UNSET:
            field_dict["number"] = number
        if opened_at is not UNSET:
            field_dict["opened_at"] = opened_at
        if plan is not UNSET:
            field_dict["plan"] = plan
        if provider is not UNSET:
            field_dict["provider"] = provider
        if remote_id is not UNSET:
            field_dict["remote_id"] = remote_id
        if remote_source is not UNSET:
            field_dict["remote_source"] = remote_source
        if status is not UNSET:
            field_dict["status"] = status
        if team is not UNSET:
            field_dict["team"] = team
        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:
        d = dict(src_dict)
        field_id = d.pop("_id", UNSET)

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

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

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

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

        format_ = d.pop("format", UNSET)

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

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

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

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

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

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

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

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

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

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

        type_ = d.pop("type", UNSET)

        legacytypes_investment_account = cls(
            field_id=field_id,
            closed_at=closed_at,
            created_at=created_at,
            deleted_at=deleted_at,
            employee=employee,
            format_=format_,
            name=name,
            notes=notes,
            number=number,
            opened_at=opened_at,
            plan=plan,
            provider=provider,
            remote_id=remote_id,
            remote_source=remote_source,
            status=status,
            team=team,
            type_=type_,
        )

        legacytypes_investment_account.additional_properties = d
        return legacytypes_investment_account

    @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
