import type { Database } from '@chat-app/db-types';

export type { Database };

// Storage contract used by Supabase auth. Both `expo-secure-store` and
// `@tauri-apps/plugin-store` can be wrapped to satisfy this.
export interface KeyValueStore {
  getItem(key: string): Promise<string | null>;
  setItem(key: string, value: string): Promise<void>;
  removeItem(key: string): Promise<void>;
}

export interface SupabaseConfig {
  url: string;
  anonKey: string;
  sessionStorage: KeyValueStore;
  // Desktop Tauri webview may need this true to parse magic-link callbacks.
  detectSessionInUrl?: boolean;
}

export type DevicePlatform = Database['public']['Enums']['device_platform'];
export type PresenceState = Database['public']['Enums']['presence_state'];
export type FriendshipStatus = Database['public']['Enums']['friendship_status'];
export type MemberRole = Database['public']['Enums']['member_role'];
export type ConversationType = Database['public']['Enums']['conversation_type'];
