import { NextResponse } from 'next/server'
import { requireAdmin } from '@/lib/auth'

// Simulated backup storage (in production, store in filesystem or cloud storage)
const backups: Array<{
  id: string
  filename: string
  size: number
  createdAt: string
  type: 'auto' | 'manual'
}> = []

export async function GET() {
  try {
    const adminCheck = await requireAdmin()
    if (adminCheck) return adminCheck

    return NextResponse.json(backups)
  } catch (error) {
    console.error('Failed to fetch backups:', error)
    return NextResponse.json({ error: 'Internal server error' }, { status: 500 })
  }
}
