/*
 * 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 Rfq {
    /// Identifier for this RFQ.
    #[serde(rename = "rfq_id")]
    pub rfq_id: String,
    /// Requested amount for this RFQ
    #[serde(rename = "amount")]
    pub amount: rust_decimal::Decimal,
    /// Timestamp of creation (unix timestamp)
    #[serde(rename = "create_time")]
    pub create_time: rust_decimal::Decimal,
    /// Timestamp at which this RFQ will be automatically cancelled (unix timestamp)
    #[serde(rename = "valid_until", skip_serializing_if = "Option::is_none")]
    pub valid_until: Option<rust_decimal::Decimal>,
    /// Combo legs. A minimalised version of the request such that quantities are integer.
    #[serde(rename = "legs")]
    pub legs: Vec<models::RfqLegsInner>,
    /// User label set at creation. Not visibible to market makers.
    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    #[serde(rename = "insert_reason", skip_serializing_if = "Option::is_none")]
    pub insert_reason: Option<models::RfqInsertReasonEnum>,
    #[serde(rename = "delete_reason", skip_serializing_if = "Option::is_none")]
    pub delete_reason: Option<models::RfqDeleteReasonEnum>,
    /// The minimum size / size increase for quotes.
    #[serde(rename = "volume_tick_size", skip_serializing_if = "Option::is_none")]
    pub volume_tick_size: Option<rust_decimal::Decimal>,
    #[serde(rename = "quoted_bid", skip_serializing_if = "Option::is_none")]
    pub quoted_bid: Option<models::RfqQuotedBid>,
    #[serde(rename = "quoted_ask", skip_serializing_if = "Option::is_none")]
    pub quoted_ask: Option<models::RfqQuotedAsk>,
    /// Combo price for which this RFQ was traded.
    #[serde(rename = "trade_price", skip_serializing_if = "Option::is_none")]
    pub trade_price: Option<rust_decimal::Decimal>,
    /// Amount in which this RFQ was traded.
    #[serde(rename = "trade_amount", skip_serializing_if = "Option::is_none")]
    pub trade_amount: Option<rust_decimal::Decimal>,
    /// Time at which this RFQ was cancelled or traded.
    #[serde(rename = "close_time", skip_serializing_if = "Option::is_none")]
    pub close_time: Option<rust_decimal::Decimal>,
    #[serde(rename = "event", skip_serializing_if = "Option::is_none")]
    pub event: Option<models::RfqEventEnum>,
}

impl Rfq {
    pub fn new(
        rfq_id: String,
        amount: rust_decimal::Decimal,
        create_time: rust_decimal::Decimal,
        legs: Vec<models::RfqLegsInner>,
    ) -> Rfq {
        Rfq {
            rfq_id,
            amount,
            create_time,
            valid_until: None,
            legs,
            label: None,
            insert_reason: None,
            delete_reason: None,
            volume_tick_size: None,
            quoted_bid: None,
            quoted_ask: None,
            trade_price: None,
            trade_amount: None,
            close_time: None,
            event: None,
        }
    }
}
