/*
 * Thalex RPC API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * 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 MassQuoteParams {
    /// List of quotes (maximum 100).  Each item is a double-sided quotes array on a single instrument. A quotes array atomically replaces a previous quotes array. Both bid and ask price may be specified. If either bid or ask is not specified, that side is *not* replaced or removed. If a double-sided quotes array for an instrument that was specified in an earlier call is omitted from the next call, these quotes are *not* removed or replaced.  When a side quotes array is specified, any omitted previous quotes *will* be removed. To remove all quotes on a side, send an empty quotes array.  Sending a quote with the exact same price and amount as in the previous call *will not* replace the quote, thus preserving the quote's priority.  Mass quoting allows for a maximum of 10 level quotes on each side per instrument.  Note that market maker protection must have been configured for the instrument's product group, and both bid and ask amount must not exceed the most recent protection configuration amount.
    #[serde(rename = "quotes")]
    pub quotes: Vec<models::DoubleSidedQuote>,
    /// Optional user label to apply to every quote side.
    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    /// If set, price may be widened so it will not cross an existing order in the book. If the adjusted price for any bid falls at or below zero where not allowed, then that side will be removed with delete reason 'immediate_cancel'.
    #[serde(rename = "post_only", skip_serializing_if = "Option::is_none")]
    pub post_only: Option<bool>,
    /// This flag is only effective in combination with post_only. If set, then instead of adjusting the order price, the order will be cancelled with delete reason 'immediate_cancel'. The combination of post_only and reject_post_only is effectively a book-or-cancel order.
    #[serde(rename = "reject_post_only", skip_serializing_if = "Option::is_none")]
    pub reject_post_only: Option<bool>,
    #[serde(rename = "stp_level", skip_serializing_if = "Option::is_none")]
    pub stp_level: Option<models::StpLevelEnum>,
    #[serde(rename = "stp_action", skip_serializing_if = "Option::is_none")]
    pub stp_action: Option<models::StpActionEnum>,
}

impl MassQuoteParams {
    pub fn new(quotes: Vec<models::DoubleSidedQuote>) -> MassQuoteParams {
        MassQuoteParams {
            quotes,
            label: None,
            post_only: None,
            reject_post_only: None,
            stp_level: None,
            stp_action: None,
        }
    }
}
