/*
 * Websocket Subscription Schemas
 *
 * Schema definitions Websocket API subscriptions for Thalex exchange.
 *
 * 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 BasePricePayload {
    /// Instrument name of future, or \"synthetic\".
    #[serde(rename = "base_name")]
    pub base_name: String,
    /// Forward price of the expiration.
    #[serde(rename = "price")]
    pub price: rust_decimal::Decimal,
    /// Index price of the underlying of the instrument.
    #[serde(rename = "index")]
    pub index: rust_decimal::Decimal,
    /// Before expiration, Thalex linearly scales the deltas of the expiring instruments to zero, over a time window. This number represents how far into this process the expiration is (i.e. delta used for margining = index_delta * actual delta of the instrument).
    #[serde(rename = "index_delta", skip_serializing_if = "Option::is_none")]
    pub index_delta: Option<rust_decimal::Decimal>,
}

impl BasePricePayload {
    pub fn new(
        base_name: String,
        price: rust_decimal::Decimal,
        index: rust_decimal::Decimal,
    ) -> BasePricePayload {
        BasePricePayload {
            base_name,
            price,
            index,
            index_delta: None,
        }
    }
}
