import { createClient } from '@chat-app/shared/supabase';

import { env } from './env';
import { sessionStorage } from './sessionStorage';

// Single Supabase client instance for the mobile app. Token storage goes
// to AsyncStorage so the session survives reboots. detectSessionInUrl is
// false because the magic-link callback is handled by our own
// app/auth/callback.tsx screen — Expo Router routes the deep link to
// that file, and we parse it explicitly.
export const supabase = createClient({
  url: env.supabaseUrl,
  anonKey: env.supabaseAnonKey,
  sessionStorage,
  detectSessionInUrl: false,
});
