/*
 * 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};

/// TradeValue : The aggregated trading volume per date time bucket, underlying and instrument category.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TradeValue {
    /// Underlying name.
    #[serde(rename = "underlying")]
    pub underlying: String,
    /// Total trading volume for the underlying instrument category.
    #[serde(rename = "trade_volume")]
    pub trade_volume: rust_decimal::Decimal,
    /// The total value traded for the underlying instrument category.
    #[serde(rename = "trade_value")]
    pub trade_value: rust_decimal::Decimal,
    #[serde(rename = "category")]
    pub category: models::CategoryEnum,
    #[serde(rename = "date_time_bucket", deserialize_with = "Option::deserialize")]
    pub date_time_bucket: Option<serde_json::Value>,
}

impl TradeValue {
    /// The aggregated trading volume per date time bucket, underlying and instrument category.
    pub fn new(
        underlying: String,
        trade_volume: rust_decimal::Decimal,
        trade_value: rust_decimal::Decimal,
        category: models::CategoryEnum,
        date_time_bucket: Option<serde_json::Value>,
    ) -> TradeValue {
        TradeValue {
            underlying,
            trade_volume,
            trade_value,
            category,
            date_time_bucket,
        }
    }
}
