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


@_attrs_define
class PkgRoutesComplianceGetRKDataResponse:
    """
    Attributes:
        beginning_balance (float | Unset):
        deposits (float | Unset):
        ending_balance (float | Unset):
        expenses_fees (float | Unset):
        gain_loss (float | Unset):
        income (float | Unset):
        withdrawals (float | Unset):
    """

    beginning_balance: float | Unset = UNSET
    deposits: float | Unset = UNSET
    ending_balance: float | Unset = UNSET
    expenses_fees: float | Unset = UNSET
    gain_loss: float | Unset = UNSET
    income: float | Unset = UNSET
    withdrawals: float | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        deposits = self.deposits

        ending_balance = self.ending_balance

        expenses_fees = self.expenses_fees

        gain_loss = self.gain_loss

        income = self.income

        withdrawals = self.withdrawals

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if beginning_balance is not UNSET:
            field_dict["beginning_balance"] = beginning_balance
        if deposits is not UNSET:
            field_dict["deposits"] = deposits
        if ending_balance is not UNSET:
            field_dict["ending_balance"] = ending_balance
        if expenses_fees is not UNSET:
            field_dict["expenses_fees"] = expenses_fees
        if gain_loss is not UNSET:
            field_dict["gain_loss"] = gain_loss
        if income is not UNSET:
            field_dict["income"] = income
        if withdrawals is not UNSET:
            field_dict["withdrawals"] = withdrawals

        return field_dict

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

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

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

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

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

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

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

        pkg_routes_compliance_get_rk_data_response = cls(
            beginning_balance=beginning_balance,
            deposits=deposits,
            ending_balance=ending_balance,
            expenses_fees=expenses_fees,
            gain_loss=gain_loss,
            income=income,
            withdrawals=withdrawals,
        )

        pkg_routes_compliance_get_rk_data_response.additional_properties = d
        return pkg_routes_compliance_get_rk_data_response

    @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
