import Stripe from 'stripe'

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
  apiVersion: '2025-04-30.basil' as any,
})

const plans = [
  { name: 'Teste', amount: 1, interval: 'month' as const },
  { name: 'Starter', amount: 9700, interval: 'month' as const },
  { name: 'Pro', amount: 19700, interval: 'month' as const },
  { name: 'Enterprise', amount: 49700, interval: 'month' as const },
]

async function main() {
  console.log('Creating Stripe products and prices...\n')

  for (const plan of plans) {
    const product = await stripe.products.create({
      name: `LexMind ${plan.name}`,
      description: `Plano ${plan.name} - LexMind`,
    })

    const price = await stripe.prices.create({
      product: product.id,
      unit_amount: plan.amount,
      currency: 'brl',
      recurring: { interval: plan.interval },
    })

    console.log(`${plan.name}: product=${product.id} price=${price.id} (R$${(plan.amount / 100).toFixed(2)}/month)`)
  }

  console.log('\nDone! Copy the price IDs above into your code.')
}

main().catch(console.error)
