import 'dotenv/config'
import { ConvexHttpClient } from 'convex/browser'
import { api } from '../convex/_generated/api.js'

async function main() {
  const url = process.env.NEXT_PUBLIC_CONVEX_URL || 'http://127.0.0.1:3210'
  const client = new ConvexHttpClient(url)
  console.log(`[seed] Using Convex at ${url}`)
  try {
    await client.mutation(api.seed.seedDemo, {})
    console.log('[seed] Convex demo data ensured (queues/users)')
  } catch (err) {
    console.error('[seed] Failed to seed Convex demo data:', err?.message || err)
    process.exitCode = 1
  }
}

main()

