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

//! Trade-event entity.

/// Persisted trade-event row.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, sqlx::FromRow)]
pub struct TradeEventEntity {
    /// Numeric primary key.
    pub id: i64,
    /// Related DEX id.
    pub dex_id: i64,
    /// Related pool id.
    pub pool_id: i64,
    /// Related pair id.
    pub pair_id: i64,
    /// Related transaction id.
    pub transaction_id: i64,
    /// Related decoded event id.
    pub decoded_event_id: i64,
    /// Related transaction signature.
    pub signature: std::string::String,
    /// Optional observed slot.
    pub slot: std::option::Option<i64>,
    /// Stable trade side.
    pub trade_side: std::string::String,
    /// Related base token id.
    pub base_token_id: i64,
    /// Related quote token id.
    pub quote_token_id: i64,
    /// Optional raw base amount.
    pub base_amount_raw: std::option::Option<std::string::String>,
    /// Optional raw quote amount.
    pub quote_amount_raw: std::option::Option<std::string::String>,
    /// Optional derived quote-per-base price.
    pub price_quote_per_base: std::option::Option<f64>,
    /// Observation source kind.
    pub source_kind: i16,
    /// Optional logical source endpoint name.
    pub source_endpoint_name: std::option::Option<std::string::String>,
    /// Persisted payload JSON.
    pub payload_json: 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,
}
