/*
 * 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 RequiredMarginForOrderParams {
    /// The name of the instrument of this hypothetical order with which the margin is to be broken down with. This field must not be present when requesting margin breakdown for a combination order. Use `legs` field instead.
    #[serde(rename = "instrument_name", skip_serializing_if = "Option::is_none")]
    pub instrument_name: Option<String>,
    /// List of legs for a combination order.  There must be at least two and at most four legs specified. All leg instruments must be distinct.  Other constraints apply, please check trading information page on combination orders.  This field must not be present when requesting margin breakdown for single-leg orders. Use `instrument_name` field instead.
    #[serde(rename = "legs", skip_serializing_if = "Option::is_none")]
    pub legs: Option<Vec<models::RequiredMarginForOrderParamsLegsInner>>,
    /// The price of the hypothetical order.
    #[serde(rename = "price")]
    pub price: rust_decimal::Decimal,
    /// The amount that would be traded.
    #[serde(rename = "amount")]
    pub amount: rust_decimal::Decimal,
}

impl RequiredMarginForOrderParams {
    pub fn new(
        price: rust_decimal::Decimal,
        amount: rust_decimal::Decimal,
    ) -> RequiredMarginForOrderParams {
        RequiredMarginForOrderParams {
            instrument_name: None,
            legs: None,
            price,
            amount,
        }
    }
}
