/*
 * Thalex RPC API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AccountBreakdownRpcResultCashInner {
    /// Currency name.
    #[serde(rename = "currency")]
    pub currency: String,
    /// Current balance in this currency.
    #[serde(rename = "balance")]
    pub balance: rust_decimal::Decimal,
    /// The collateral quality of the asset i.e. the fraction of the asset that can be used as a collateral.
    #[serde(rename = "collateral_factor")]
    pub collateral_factor: rust_decimal::Decimal,
    /// Index price used to calculate collateral effect of this position. Can be `null` for assets that are not converted using an index, e.g. for stable coins.
    #[serde(
        rename = "collateral_index_price",
        skip_serializing_if = "Option::is_none"
    )]
    pub collateral_index_price: Option<rust_decimal::Decimal>,
    /// Total collateral effect of this position.
    #[serde(rename = "applied_collateral")]
    pub applied_collateral: rust_decimal::Decimal,
    /// If this flag is `true`, this currency can be deposited and withdrawn.
    #[serde(rename = "transactable")]
    pub transactable: bool,
}

impl AccountBreakdownRpcResultCashInner {
    pub fn new(
        currency: String,
        balance: rust_decimal::Decimal,
        collateral_factor: rust_decimal::Decimal,
        applied_collateral: rust_decimal::Decimal,
        transactable: bool,
    ) -> AccountBreakdownRpcResultCashInner {
        AccountBreakdownRpcResultCashInner {
            currency,
            balance,
            collateral_factor,
            collateral_index_price: None,
            applied_collateral,
            transactable,
        }
    }
}
