/*
 * 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 Deposit {
    /// Deposited currency symbol.
    #[serde(rename = "currency")]
    pub currency: String,
    /// Amount of currency deposited.
    #[serde(rename = "amount")]
    pub amount: rust_decimal::Decimal,
    /// Blockchain used or this transaction.
    #[serde(rename = "blockchain")]
    pub blockchain: String,
    /// Transaction hash on the used blockchain.
    #[serde(rename = "transaction_hash")]
    pub transaction_hash: String,
    /// Time when this transaction was created (Unix timestamp).
    #[serde(rename = "transaction_timestamp")]
    pub transaction_timestamp: rust_decimal::Decimal,
    #[serde(rename = "status")]
    pub status: models::DepositStatusEnum,
    /// Number of confirmations. Optional, omitted when none.
    #[serde(rename = "confirmations", skip_serializing_if = "Option::is_none")]
    pub confirmations: Option<rust_decimal::Decimal>,
}

impl Deposit {
    pub fn new(
        currency: String,
        amount: rust_decimal::Decimal,
        blockchain: String,
        transaction_hash: String,
        transaction_timestamp: rust_decimal::Decimal,
        status: models::DepositStatusEnum,
    ) -> Deposit {
        Deposit {
            currency,
            amount,
            blockchain,
            transaction_hash,
            transaction_timestamp,
            status,
            confirmations: None,
        }
    }
}
