import { PageHeader } from '@/components/shared/page-header';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';

export default function BackupManagementPage() {
  return (
    <div>
      <PageHeader
        title="Backup &amp; Restore"
        description="How backups are taken today and what an in-app backup admin will look like."
      />

      <div className="grid gap-4 mt-6 lg:grid-cols-2">
        <Card>
          <CardHeader>
            <CardTitle>Current backup posture</CardTitle>
            <CardDescription>
              Database snapshots run outside the app — there is no in-app trigger yet.
            </CardDescription>
          </CardHeader>
          <CardContent className="space-y-3 text-sm">
            <p>
              <strong>PostgreSQL:</strong> snapshotted by the platform&rsquo;s nightly{' '}
              <code>pg_dump</code> job. Retention is set at the infrastructure layer (see{' '}
              <code>docs/operations/</code> if a runbook exists). Restores are manual.
            </p>
            <p>
              <strong>Object storage:</strong> when{' '}
              <code>system_settings.storage_backend = &lsquo;s3&rsquo;</code>, the bucket is
              versioned by the provider. When the filesystem backend is in use, the host&rsquo;s
              snapshot policy is the only safety net — switch to s3 before relying on point-in-time
              recovery.
            </p>
            <p>
              <strong>Redis / queue state:</strong> ephemeral. Failed jobs sit on the{' '}
              <code>removeOnFail</code> retention window (7 days) and then disappear. Anything
              durable belongs in PostgreSQL.
            </p>
          </CardContent>
        </Card>

        <Card>
          <CardHeader>
            <CardTitle>What this page will become</CardTitle>
            <CardDescription>Planned admin surface, prioritised in upcoming work.</CardDescription>
          </CardHeader>
          <CardContent className="space-y-2 text-sm">
            <ul className="list-disc pl-5 space-y-1">
              <li>List recent snapshot files with timestamp, size, and origin (cron vs manual).</li>
              <li>&ldquo;Take backup now&rdquo; button that enqueues a maintenance job.</li>
              <li>
                Per-port logical export (&ldquo;give me everything for port-nimara&rdquo;) for
                compliance.
              </li>
              <li>Restore preview that shows row-counts that would change before commit.</li>
              <li>GDPR per-client export bundled here.</li>
            </ul>
            <p className="text-xs text-muted-foreground pt-2">
              Until this lands, treat ops/devops as the source of truth for backup state.
            </p>
          </CardContent>
        </Card>
      </div>
    </div>
  );
}
