//! Data access helpers and Supabase clients.
//!
//! Provides functions to construct preconfigured `SupabaseClient` instances for
//! Athena and Suitsbooks projects, loaded from environment variables.
use dotenv::dotenv;
use dotenv::var;
use supabase_rs::SupabaseClient;

pub mod api_registry;
pub mod athena_router;
pub mod events;
pub mod parse {
    pub mod strip_nulls;
}

pub async fn athena_supabase() -> SupabaseClient {
    dotenv().ok(); // Load the .env file

    let supabase_client: SupabaseClient = SupabaseClient::new(
        var("XLX_ATHENA_SUPABASE_URL").unwrap(),
        var("XLX_ATHENA_SUPABASE_KEY").unwrap(),
    )
    .unwrap();

    supabase_client
}

pub async fn suitsbooks_supabase() -> SupabaseClient {
    dotenv().ok(); // Load the .env file

    let supabase_client: SupabaseClient = SupabaseClient::new(
        var("XLX_SB_SUPABASE_URL").unwrap(),
        var("XLX_SB_SUPABASE_KEY").unwrap(),
    )
    .unwrap();

    supabase_client
}
