import { NextResponse } from 'next/server'
import prisma from '@/lib/prisma'

export const dynamic = 'force-dynamic'

export async function GET() {
  try {
    const packages = await prisma.pterodactylPackage.findMany({
      where: { isActive: true },
      orderBy: { sortOrder: 'asc' }
    })
    return NextResponse.json(packages)
  } catch (error) {
    return NextResponse.json({ error: 'Gagal memuat paket hosting' }, { status: 500 })
  }
}
