// file: kb_lib/src/db/entities/pair_candle.rs

//! Pair-candle entity.

/// Persisted pair-candle row.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, sqlx::FromRow)]
pub struct PairCandleEntity {
    /// Numeric primary key.
    pub id: i64,
    /// Related pair id.
    pub pair_id: i64,
    /// Candle timeframe in seconds.
    pub timeframe_seconds: i64,
    /// Inclusive bucket start in unix seconds.
    pub bucket_start_unix: i64,
    /// Exclusive bucket end in unix seconds.
    pub bucket_end_unix: i64,
    /// Open price in quote-per-base units.
    pub open_price_quote_per_base: f64,
    /// High price in quote-per-base units.
    pub high_price_quote_per_base: f64,
    /// Low price in quote-per-base units.
    pub low_price_quote_per_base: f64,
    /// Close price in quote-per-base units.
    pub close_price_quote_per_base: f64,
    /// Trade count inside the candle.
    pub trade_count: i64,
    /// Buy count inside the candle.
    pub buy_count: i64,
    /// Sell count inside the candle.
    pub sell_count: i64,
    /// Aggregated base volume as decimal text when available.
    pub base_volume_raw: std::option::Option<std::string::String>,
    /// Aggregated quote volume as decimal text when available.
    pub quote_volume_raw: std::option::Option<std::string::String>,
    /// Optional first trade signature inside the candle.
    pub first_trade_signature: std::option::Option<std::string::String>,
    /// Optional last trade signature inside the candle.
    pub last_trade_signature: std::option::Option<std::string::String>,
    /// Creation timestamp encoded as RFC3339 UTC text.
    pub created_at: std::string::String,
    /// Update timestamp encoded as RFC3339 UTC text.
    pub updated_at: std::string::String,
}
