/*
 * 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 DailyMark {
    /// Time of settlement (Unix timestamp).
    #[serde(rename = "time")]
    pub time: rust_decimal::Decimal,
    /// Instrument name.
    #[serde(rename = "instrument_name")]
    pub instrument_name: String,
    /// Position in the instrument.
    #[serde(rename = "position")]
    pub position: rust_decimal::Decimal,
    /// Mark price used for settlement.
    #[serde(rename = "mark_price")]
    pub mark_price: rust_decimal::Decimal,
    /// Realized profit or loss for this position.
    #[serde(rename = "realized_position_pnl")]
    pub realized_position_pnl: rust_decimal::Decimal,
    /// Realized perpetual funding. Only present for perpetuals.
    #[serde(
        rename = "realized_funding_pnl",
        skip_serializing_if = "Option::is_none"
    )]
    pub realized_funding_pnl: Option<rust_decimal::Decimal>,
}

impl DailyMark {
    pub fn new(
        time: rust_decimal::Decimal,
        instrument_name: String,
        position: rust_decimal::Decimal,
        mark_price: rust_decimal::Decimal,
        realized_position_pnl: rust_decimal::Decimal,
    ) -> DailyMark {
        DailyMark {
            time,
            instrument_name,
            position,
            mark_price,
            realized_position_pnl,
            realized_funding_pnl: None,
        }
    }
}
