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

//! Swap entity.

/// Persisted normalized swap row.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, sqlx::FromRow)]
pub struct SwapEntity {
    /// Numeric primary key.
    pub id: i64,
    /// Related DEX id.
    pub dex_id: i64,
    /// Related pool id.
    pub pool_id: i64,
    /// Optional related pair id.
    pub pair_id: std::option::Option<i64>,
    /// Transaction signature.
    pub signature: std::string::String,
    /// Instruction index inside the transaction.
    pub instruction_index: i64,
    /// Optional slot number.
    pub slot: std::option::Option<i64>,
    /// Optional trader wallet.
    pub trader_wallet: std::option::Option<std::string::String>,
    /// Base token id.
    pub base_token_id: i64,
    /// Quote token id.
    pub quote_token_id: i64,
    /// Base amount as decimal text.
    pub base_amount: std::string::String,
    /// Quote amount as decimal text.
    pub quote_amount: std::string::String,
    /// Optional price in quote units as decimal text.
    pub price_quote: std::option::Option<std::string::String>,
    /// Trade side stored as stable integer.
    pub trade_side: i16,
    /// Execution timestamp encoded as RFC3339 UTC text.
    pub executed_at: std::string::String,
}
