/*
 * 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 CreateConditionalOrderParams {
    #[serde(rename = "direction")]
    pub direction: models::DirectionEnum,
    #[serde(rename = "instrument_name")]
    pub instrument_name: String,
    #[serde(rename = "amount")]
    pub amount: rust_decimal::Decimal,
    /// If set, creates a stop limit order
    #[serde(rename = "limit_price", skip_serializing_if = "Option::is_none")]
    pub limit_price: Option<rust_decimal::Decimal>,
    #[serde(rename = "target", skip_serializing_if = "Option::is_none")]
    pub target: Option<models::TargetEnum>,
    /// Trigger price
    #[serde(rename = "stop_price")]
    pub stop_price: rust_decimal::Decimal,
    /// If set, creates a bracket order
    #[serde(rename = "bracket_price", skip_serializing_if = "Option::is_none")]
    pub bracket_price: Option<rust_decimal::Decimal>,
    /// If set, creates a trailing stop order
    #[serde(
        rename = "trailing_stop_callback_rate",
        skip_serializing_if = "Option::is_none"
    )]
    pub trailing_stop_callback_rate: Option<rust_decimal::Decimal>,
    /// Label will be set on the activated order
    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    /// Activated order will be reduce-only
    #[serde(rename = "reduce_only", skip_serializing_if = "Option::is_none")]
    pub reduce_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 CreateConditionalOrderParams {
    pub fn new(
        direction: models::DirectionEnum,
        instrument_name: String,
        amount: rust_decimal::Decimal,
        stop_price: rust_decimal::Decimal,
    ) -> CreateConditionalOrderParams {
        CreateConditionalOrderParams {
            direction,
            instrument_name,
            amount,
            limit_price: None,
            target: None,
            stop_price,
            bracket_price: None,
            trailing_stop_callback_rate: None,
            label: None,
            reduce_only: None,
            stp_level: None,
            stp_action: None,
        }
    }
}
