/*
 * Websocket Subscription Schemas
 *
 * Schema definitions Websocket API subscriptions for Thalex exchange.
 *
 * 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 BookPayload {
    /// List of `[price, amount, direction, timestamp, implied_taker]`. Note that the snapshot of this feed may contain older trades that happened since the last restart of the gateway.  The `implied_taker` is a boolean flag, set to `true` when the actual taker trade happened on another order book, and the maker trade on this book is the result of implied matching.  Trades are not sent for combination order books.
    #[serde(rename = "trades", skip_serializing_if = "Option::is_none")]
    pub trades: Option<Vec<serde_json::Value>>,
    /// List of price level updates (price, amount, outright amount) for buy orders, amount 0 means level is now empty.  For combination order books, price and amount refer to the price and amount per unit of the combination.
    #[serde(rename = "bid_changes", skip_serializing_if = "Option::is_none")]
    pub bid_changes: Option<Vec<serde_json::Value>>,
    /// List of price level updates (price, amount, outright amount) for sell orders, amount 0 means level is now empty.  For combination order books, price and amount refer to the price and amount per unit of the combination.
    #[serde(rename = "ask_changes", skip_serializing_if = "Option::is_none")]
    pub ask_changes: Option<Vec<serde_json::Value>>,
    /// The total amount of bid orders across all levels.
    #[serde(rename = "total_bid_amount", skip_serializing_if = "Option::is_none")]
    pub total_bid_amount: Option<rust_decimal::Decimal>,
    /// The total amount of ask orders across all levels.
    #[serde(rename = "total_ask_amount", skip_serializing_if = "Option::is_none")]
    pub total_ask_amount: Option<rust_decimal::Decimal>,
    /// Time of the last recorded update to this order book (Unix timestamp).
    #[serde(rename = "time", skip_serializing_if = "Option::is_none")]
    pub time: Option<rust_decimal::Decimal>,
}

impl BookPayload {
    pub fn new() -> BookPayload {
        BookPayload {
            trades: None,
            bid_changes: None,
            ask_changes: None,
            total_bid_amount: None,
            total_ask_amount: None,
            time: None,
        }
    }
}
