/*
 * 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 MarketLiquidityDto {
    /// Most recent book update, created timestamp if never updated (ms since Unix Epoch)
    #[serde(rename = "timestamp")]
    pub timestamp: f64,
    /// Previous book update, undefined if never updated (ms since Unix Epoch)
    #[serde(rename = "previousTimestamp", skip_serializing_if = "Option::is_none")]
    pub previous_timestamp: Option<f64>,
    /// Id representing the product
    #[serde(rename = "productId")]
    pub product_id: uuid::Uuid,
    /// An array of ask tuple pairs (price, quantity) ordered in asc
    #[serde(rename = "asks")]
    pub asks: Vec<Vec<serde_json::Value>>,
    /// An array of bid tuple pairs (price, quantity) ordered in desc
    #[serde(rename = "bids")]
    pub bids: Vec<Vec<serde_json::Value>>,
}

impl MarketLiquidityDto {
    pub fn new(
        timestamp: f64,
        product_id: uuid::Uuid,
        asks: Vec<Vec<serde_json::Value>>,
        bids: Vec<Vec<serde_json::Value>>,
    ) -> MarketLiquidityDto {
        MarketLiquidityDto {
            timestamp,
            previous_timestamp: None,
            product_id,
            asks,
            bids,
        }
    }
}
