/*
 * Ethereal Exchange API
 *
 * Ethereal HTTP API for real-time trading, order management, and market data access.
 *
 * The version of the OpenAPI document: 0.1.0
 *
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WithdrawDto {
    /// Id representing the withdraw
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// Block number the withdraw was initiated on
    #[serde(
        rename = "initiatedBlockNumber",
        skip_serializing_if = "Option::is_none"
    )]
    pub initiated_block_number: Option<String>,
    /// Block number the withdraw was completed on
    #[serde(
        rename = "finalizedBlockNumber",
        skip_serializing_if = "Option::is_none"
    )]
    pub finalized_block_number: Option<String>,
    #[serde(rename = "status")]
    pub status: models::WithdrawDtoOrderStatus,
    /// Bytes32 encoded subaccount name (0x prefix, zero padded)
    #[serde(rename = "subaccount")]
    pub subaccount: String,
    /// Address of asset to withdraw (non-checksummed)
    #[serde(rename = "token")]
    pub token: String,
    /// LayerZero destination address (leading 0x bytes32 encoded) for the transfer (if withdraw)
    #[serde(
        rename = "lzDestinationAddress",
        skip_serializing_if = "Option::is_none"
    )]
    pub lz_destination_address: Option<String>,
    /// LayerZero destination endpoint ID for the transfer (if withdraw)
    #[serde(rename = "lzDestinationEid", skip_serializing_if = "Option::is_none")]
    pub lz_destination_eid: Option<i64>,
    /// Amount of asset transferred expressed as a decimal
    #[serde(rename = "amount")]
    pub amount: String,
    /// Withdraw creation timestamp (ms since Unix Epoch)
    #[serde(rename = "createdAt")]
    pub created_at: i64,
    /// Bytes32 hash of the withdraw data (with 0x prefix)
    #[serde(rename = "withdrawDigest")]
    pub withdraw_digest: String,
}

impl WithdrawDto {
    pub fn new(
        id: uuid::Uuid,
        status: models::WithdrawDtoOrderStatus,
        subaccount: String,
        token: String,
        amount: String,
        created_at: i64,
        withdraw_digest: String,
    ) -> WithdrawDto {
        WithdrawDto {
            id,
            initiated_block_number: None,
            finalized_block_number: None,
            status,
            subaccount,
            token,
            lz_destination_address: None,
            lz_destination_eid: None,
            amount,
            created_at,
            withdraw_digest,
        }
    }
}
