import Link from 'next/link'
import { redirect } from 'next/navigation'
import { getCurrentUser } from '@/lib/session'
import FlowPanel from './_components/flow-panel'

export const dynamic = 'force-dynamic'

export default async function ServerBackupPage() {
  const user = await getCurrentUser()
  if (!user) redirect('/login')

  return (
    <div className="min-h-screen bg-background p-6">
      <div className="mx-auto max-w-4xl space-y-6">
        <div className="flex items-center gap-3">
          <Link href="/" className="text-sm text-muted-foreground hover:text-foreground">
            ← Home
          </Link>
          <span className="text-muted-foreground">/</span>
          <Link href="/flows" className="text-sm text-muted-foreground hover:text-foreground">
            Flows
          </Link>
          <span className="text-muted-foreground">/</span>
          <h1 className="text-2xl font-semibold tracking-tight">Server backup</h1>
        </div>

        <FlowPanel />
      </div>
    </div>
  )
}
