/*
 * 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 AccountBreakdownRpcResultPortfolioInner {
    #[serde(rename = "instrument_name")]
    pub instrument_name: String,
    #[serde(rename = "position")]
    pub position: rust_decimal::Decimal,
    #[serde(rename = "mark_price", skip_serializing_if = "Option::is_none")]
    pub mark_price: Option<rust_decimal::Decimal>,
    #[serde(rename = "start_price", skip_serializing_if = "Option::is_none")]
    pub start_price: Option<rust_decimal::Decimal>,
    #[serde(rename = "average_price", skip_serializing_if = "Option::is_none")]
    pub average_price: Option<rust_decimal::Decimal>,
    #[serde(rename = "unrealised_pnl_positional")]
    pub unrealised_pnl_positional: rust_decimal::Decimal,
    #[serde(
        rename = "unrealised_pnl_perpetual",
        skip_serializing_if = "Option::is_none"
    )]
    pub unrealised_pnl_perpetual: Option<rust_decimal::Decimal>,
    #[serde(rename = "unrealised_pnl")]
    pub unrealised_pnl: rust_decimal::Decimal,
    #[serde(rename = "realised_position_pnl")]
    pub realised_position_pnl: rust_decimal::Decimal,
    #[serde(rename = "open_buy_amount")]
    pub open_buy_amount: rust_decimal::Decimal,
    #[serde(rename = "open_sell_amount")]
    pub open_sell_amount: rust_decimal::Decimal,
    #[serde(rename = "session_realised_pnl")]
    pub session_realised_pnl: rust_decimal::Decimal,
    #[serde(rename = "realised_perpetual_funding")]
    pub realised_perpetual_funding: rust_decimal::Decimal,
    #[serde(rename = "session_fees")]
    pub session_fees: rust_decimal::Decimal,
}

impl AccountBreakdownRpcResultPortfolioInner {
    pub fn new(
        instrument_name: String,
        position: rust_decimal::Decimal,
        unrealised_pnl_positional: rust_decimal::Decimal,
        unrealised_pnl: rust_decimal::Decimal,
        realised_position_pnl: rust_decimal::Decimal,
        open_buy_amount: rust_decimal::Decimal,
        open_sell_amount: rust_decimal::Decimal,
        session_realised_pnl: rust_decimal::Decimal,
        realised_perpetual_funding: rust_decimal::Decimal,
        session_fees: rust_decimal::Decimal,
    ) -> AccountBreakdownRpcResultPortfolioInner {
        AccountBreakdownRpcResultPortfolioInner {
            instrument_name,
            position,
            mark_price: None,
            start_price: None,
            average_price: None,
            unrealised_pnl_positional,
            unrealised_pnl_perpetual: None,
            unrealised_pnl,
            realised_position_pnl,
            open_buy_amount,
            open_sell_amount,
            session_realised_pnl,
            realised_perpetual_funding,
            session_fees,
        }
    }
}
