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

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

/// L2BookMessage : Server-to-client L2Book event message. First message is the full book. Subsequent messages are price-level diffs with absolute quantities. A zero quantity removes that level.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct L2BookMessage {
    /// Event type.
    #[serde(rename = "e")]
    pub e: E,
    /// System timestamp in milliseconds when this message was emitted.
    #[serde(rename = "t")]
    pub t: i64,
    #[serde(rename = "data")]
    pub data: models::L2BookMessageData,
}

impl L2BookMessage {
    /// Server-to-client L2Book event message. First message is the full book. Subsequent messages are price-level diffs with absolute quantities. A zero quantity removes that level.
    pub fn new(e: E, t: i64, data: models::L2BookMessageData) -> L2BookMessage {
        L2BookMessage { e, t, data }
    }
}
/// Event type.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum E {
    #[serde(rename = "L2Book")]
    L2Book,
}

impl Default for E {
    fn default() -> E {
        Self::L2Book
    }
}
