require('dotenv').config();
const { createClient } = require('@supabase/supabase-js');

const supabase = createClient(
  process.env.SUPABASE_URL,
  process.env.SUPABASE_SERVICE_KEY
);

async function reviewAIWork() {
  const { data } = await supabase
    .from('submissions')
    .select('content, is_ai, status, task_id')
    .eq('is_ai', true)
    .eq('status', 'submitted')
    .order('submitted_at', { ascending: false })
    .limit(5);
  
  if (!data || data.length === 0) {
    console.log('No AI submissions found');
    return;
  }
  
  for (const sub of data) {
    const { data: task } = await supabase
      .from('tasks')
      .select('title, budget')
      .eq('id', sub.task_id)
      .single();
    
    console.log('═'.repeat(60));
    console.log('📝 TASK:', task.title, '(Ⓥ' + task.budget + ')');
    console.log('═'.repeat(60));
    console.log(sub.content);
    console.log('\n');
  }
}

reviewAIWork();
