import { Bot } from 'lucide-react';

import { RegistryDrivenForm } from '@/components/admin/shared/registry-driven-form';
import { PageHeader } from '@/components/shared/page-header';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { OcrSettingsForm } from '@/components/admin/ocr-settings-form';

export default function AiAdminPage() {
  return (
    <div className="space-y-6">
      <PageHeader
        title="AI configuration"
        description="One place to manage every AI-using feature. Provider credentials and the master AI switch live here; per-feature thresholds remain in their dedicated pages, linked below."
        eyebrow="ADMIN"
      />

      <RegistryDrivenForm
        title="Master controls"
        description="Hard kill switch + budget guardrails covering every AI surface in this port."
        sections={['ai.master']}
      />

      <RegistryDrivenForm
        title="Provider credentials"
        description="Shared API keys used by AI-enabled features. AES-encrypted at rest. Per-feature pages can override the model on a feature-by-feature basis."
        sections={['ai.providers']}
      />

      <Card>
        <CardHeader>
          <CardTitle className="text-base flex items-center gap-2">
            <Bot className="h-4 w-4" /> Receipt OCR
          </CardTitle>
          <CardDescription>
            Provider, model, and confidence thresholds for the receipt scanner. AI fallback only
            runs when the on-device parser is uncertain.
          </CardDescription>
        </CardHeader>
        <CardContent>
          <OcrSettingsForm embedded />
        </CardContent>
      </Card>
    </div>
  );
}
