import type { SupabaseClient } from '@supabase/supabase-js';
import { supabaseService } from './SupabaseService.js';

/**
 * Single import surface for legacy Postgres (Supabase JS client) access outside SupabaseService.
 * Auth-specific entry points stay on platformAuthService / supabaseService as needed.
 */
export function getLegacySupabaseClient(): SupabaseClient | null {
    return supabaseService.getClient();
}

export async function loadLatestLegacyBotStateSnapshot(
    ownerId: string
): Promise<{ state: unknown } | null> {
    return supabaseService.loadLatestBotStateSnapshot(ownerId);
}

export async function saveLegacyBotStateSnapshot(ownerId: string, state: unknown): Promise<void> {
    await supabaseService.saveBotStateSnapshot(ownerId, state);
}
