import { createAdminClient } from '@/shared/db/supabase-client';

// --- ASA GENERATED START ---
// Repository for billing/subscribe slice.
// --- ASA GENERATED END ---

// --- USER CODE START ---

export async function getSubscription(userId: string) {
  const supabase = createAdminClient();
  const { data, error } = await supabase
    .from('subscriptions')
    .select('*')
    .eq('user_id', userId)
    .single();

  if (error) return null;
  return data;
}

export async function getEntitlements(userId: string) {
  const supabase = createAdminClient();
  const { data, error } = await supabase
    .from('entitlements')
    .select('*')
    .eq('user_id', userId);

  if (error) return [];
  return data ?? [];
}

// --- USER CODE END ---
