/*
 * OpenAPI
 *
 * OpenAPI
 *
 * The version of the OpenAPI document: 0.0.1
 *
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PositionUpdateMessageDataDInner {
    /// Position identifier.
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// Subaccount identifier.
    #[serde(rename = "sid")]
    pub sid: uuid::Uuid,
    /// Symbol.
    #[serde(rename = "s")]
    pub s: String,
    #[serde(rename = "sd")]
    pub sd: models::PositionSideEnum,
    /// Position size.
    #[serde(rename = "sz")]
    pub sz: rust_decimal::Decimal,
    /// Position cost.
    #[serde(rename = "cost")]
    pub cost: rust_decimal::Decimal,
    /// Realized PnL for this position update.
    #[serde(rename = "rpnl")]
    pub rpnl: rust_decimal::Decimal,
    /// Funding PnL for this position update.
    #[serde(rename = "fpnl")]
    pub fpnl: rust_decimal::Decimal,
    /// Fees for this position update.
    #[serde(rename = "fee")]
    pub fee: rust_decimal::Decimal,
    /// Liquidation price for this position.
    #[serde(rename = "lpx", skip_serializing_if = "Option::is_none")]
    pub lpx: Option<rust_decimal::Decimal>,
}

impl PositionUpdateMessageDataDInner {
    pub fn new(
        id: uuid::Uuid,
        sid: uuid::Uuid,
        s: String,
        sd: models::PositionSideEnum,
        sz: rust_decimal::Decimal,
        cost: rust_decimal::Decimal,
        rpnl: rust_decimal::Decimal,
        fpnl: rust_decimal::Decimal,
        fee: rust_decimal::Decimal,
    ) -> PositionUpdateMessageDataDInner {
        PositionUpdateMessageDataDInner {
            id,
            sid,
            s,
            sd,
            sz,
            cost,
            rpnl,
            fpnl,
            fee,
            lpx: None,
        }
    }
}
