/*
 * Ethereal Exchange API
 *
 * Ethereal HTTP API for real-time trading, order management, and market data access.
 *
 * The version of the OpenAPI document: 0.1.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DryRunOrderCreatedDto {
    /// Margin required for order in USD expressed as a decimal (precision: 9)
    #[serde(rename = "marginRequired")]
    pub margin_required: String,
    /// Margin available excluding this order in USD expressed as a decimal (precision: 9)
    #[serde(rename = "marginAvailable")]
    pub margin_available: String,
    /// Total used margin including this order in USD expressed as a decimal (precision: 9)
    #[serde(rename = "totalUsedMargin")]
    pub total_used_margin: String,
    /// Risk used including position and open orders in USD expressed as a decimal (precision: 9)
    #[serde(rename = "riskUsed")]
    pub risk_used: String,
    /// Risk available for the product in USD expressed as a decimal (precision: 9)
    #[serde(rename = "riskAvailable")]
    pub risk_available: String,
    /// Code indicating a result of the dry run
    #[serde(rename = "code")]
    pub code: Code,
}

impl DryRunOrderCreatedDto {
    pub fn new(
        margin_required: String,
        margin_available: String,
        total_used_margin: String,
        risk_used: String,
        risk_available: String,
        code: Code,
    ) -> DryRunOrderCreatedDto {
        DryRunOrderCreatedDto {
            margin_required,
            margin_available,
            total_used_margin,
            risk_used,
            risk_available,
            code,
        }
    }
}
/// Code indicating a result of the dry run
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Code {
    #[serde(rename = "AccountSuspended")]
    AccountSuspended,
    #[serde(rename = "CausesImmediateLiquidation")]
    CausesImmediateLiquidation,
    #[serde(rename = "DuplicateSameSideOco")]
    DuplicateSameSideOco,
    #[serde(rename = "ImmediateMatchPostOnly")]
    ImmediateMatchPostOnly,
    #[serde(rename = "InsufficientBalance")]
    InsufficientBalance,
    #[serde(rename = "LiquidationError")]
    LiquidationError,
    #[serde(rename = "MarketOrderReachedMaxSlippage")]
    MarketOrderReachedMaxSlippage,
    #[serde(rename = "OcoFilled")]
    OcoFilled,
    #[serde(rename = "Ok")]
    Ok,
    #[serde(rename = "OpenValueCapExceeded")]
    OpenValueCapExceeded,
    #[serde(rename = "OrderIncreasesPosition")]
    OrderIncreasesPosition,
    #[serde(rename = "RiskLimitExceeded")]
    RiskLimitExceeded,
    #[serde(rename = "SignerRevoked")]
    SignerRevoked,
    #[serde(rename = "TriggerCanceledError")]
    TriggerCanceledError,
    #[serde(rename = "UnfilledFillOrKill")]
    UnfilledFillOrKill,
    #[serde(rename = "UnfilledImmediateOrCancel")]
    UnfilledImmediateOrCancel,
    #[serde(rename = "UnfilledMarketOrder")]
    UnfilledMarketOrder,
}

impl Default for Code {
    fn default() -> Code {
        Self::AccountSuspended
    }
}
