/*
 * OpenAPI
 *
 * OpenAPI
 *
 * The version of the OpenAPI document: 0.0.1
 *
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct L2BookMessageData {
    /// Market symbol, e.g. BTCUSD, ETHUSD.
    #[serde(rename = "s")]
    pub s: String,
    /// Timestamp in milliseconds for this book update.
    #[serde(rename = "t")]
    pub t: i64,
    /// Timestamp in milliseconds of the previous L2Book update for this symbol.
    #[serde(rename = "pt", skip_serializing_if = "Option::is_none")]
    pub pt: Option<i64>,
    /// Ask levels as [price, quantity] string tuples.
    #[serde(rename = "a")]
    pub a: Vec<Vec<rust_decimal::Decimal>>,
    /// Bid levels as [price, quantity] string tuples.
    #[serde(rename = "b")]
    pub b: Vec<Vec<rust_decimal::Decimal>>,
}

impl L2BookMessageData {
    pub fn new(
        s: String,
        t: i64,
        a: Vec<Vec<rust_decimal::Decimal>>,
        b: Vec<Vec<rust_decimal::Decimal>>,
    ) -> L2BookMessageData {
        L2BookMessageData {
            s,
            t,
            pt: None,
            a,
            b,
        }
    }
}
