/*
 * 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 SubmitOrderCreatedDto {
    /// Id representing the created order
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// A subaccount scoped unique client-generated order id (either a UUID or alphanumeric string up to 32 characters)
    #[serde(rename = "clientOrderId", skip_serializing_if = "Option::is_none")]
    pub client_order_id: Option<String>,
    /// Filled amount in native units expressed as a decimal (precision: 9)
    #[serde(rename = "filled")]
    pub filled: String,
    /// Code indicating the result of the submission
    #[serde(rename = "result")]
    pub result: Result,
}

impl SubmitOrderCreatedDto {
    pub fn new(id: uuid::Uuid, filled: String, result: Result) -> SubmitOrderCreatedDto {
        SubmitOrderCreatedDto {
            id,
            client_order_id: None,
            filled,
            result,
        }
    }
}
/// Code indicating the result of the submission
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Result {
    #[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 Result {
    fn default() -> Result {
        Self::AccountSuspended
    }
}
