/*
 * 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};

/// RecentTrade : item is an array with the following values: `[price, size, side (\"buy\" or \"sell\"), timestamp, instrument_name, implied_taker]`.  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.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RecentTrade {
    #[serde(rename = "price", skip_serializing_if = "Option::is_none")]
    pub price: Option<rust_decimal::Decimal>,
    #[serde(rename = "size", skip_serializing_if = "Option::is_none")]
    pub size: Option<rust_decimal::Decimal>,
    #[serde(rename = "side", skip_serializing_if = "Option::is_none")]
    pub side: Option<Side>,
    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<rust_decimal::Decimal>,
    #[serde(rename = "instrument_name", skip_serializing_if = "Option::is_none")]
    pub instrument_name: Option<String>,
    #[serde(rename = "implied_taker", skip_serializing_if = "Option::is_none")]
    pub implied_taker: Option<bool>,
}

impl RecentTrade {
    /// item is an array with the following values: `[price, size, side (\"buy\" or \"sell\"), timestamp, instrument_name, implied_taker]`.  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.
    pub fn new() -> RecentTrade {
        RecentTrade {
            price: None,
            size: None,
            side: None,
            timestamp: None,
            instrument_name: None,
            implied_taker: None,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Side {
    #[serde(rename = "buy")]
    Buy,
    #[serde(rename = "sell")]
    Sell,
}

impl Default for Side {
    fn default() -> Side {
        Self::Buy
    }
}
