use chrono::{DateTime, Utc};
use rust_decimal::Decimal;
use sqlx::FromRow;

#[derive(Debug, Clone, FromRow)]
pub struct MarketTradeRow {
    pub id: i64,
    pub instrument_id: i32,
    pub time_exchange: DateTime<Utc>,
    pub time_received: DateTime<Utc>,
    pub trade_id: String,
    pub price: f64,
    pub amount: f64,
    pub side: String,
}

#[derive(Debug, Clone, FromRow)]
pub struct MarketCandleRow {
    pub id: i64,
    pub instrument_id: i32,
    pub interval: String,
    pub open_time: DateTime<Utc>,
    pub close_time: DateTime<Utc>,
    pub open: f64,
    pub high: f64,
    pub low: f64,
    pub close: f64,
    pub volume: f64,
    pub trade_count: i32,
}

#[derive(Debug, Clone, FromRow)]
pub struct MarketOrderBookL1Row {
    pub id: i64,
    pub instrument_id: i32,
    pub time_exchange: DateTime<Utc>,
    pub time_received: DateTime<Utc>,
    pub best_bid_price: Option<Decimal>,
    pub best_bid_amount: Option<Decimal>,
    pub best_ask_price: Option<Decimal>,
    pub best_ask_amount: Option<Decimal>,
}
