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

#[derive(Debug, Clone, FromRow)]
pub struct MarketSubscriptionRow {
    pub id: i32,
    pub instrument_id: i32,
    pub sub_kind: String,
    pub active: bool,
    pub created_at: DateTime<Utc>,
    pub updated_at: DateTime<Utc>,
}

/// Enriched subscription view for the API: includes exchange/pair info.
#[derive(Debug, Clone, FromRow)]
pub struct EnrichedSubscriptionRow {
    pub id: i32,
    pub instrument_id: i32,
    pub sub_kind: String,
    pub active: bool,
    pub created_at: DateTime<Utc>,
    pub updated_at: DateTime<Utc>,
    pub exchange_name: String,
    pub base_asset: String,
    pub quote_asset: String,
}

/// Joined view for the worker: subscription + instrument + exchange in one query.
#[derive(Debug, Clone, FromRow)]
pub struct ActiveSubscriptionRow {
    pub subscription_id: i32,
    pub instrument_id: i32,
    pub sub_kind: String,
    pub exchange_name: String,
    pub name_exchange: String,
    pub base_asset: String,
    pub quote_asset: String,
    pub kind: String,
}
