/**
 * QuickActionsPanel — Dashboard quick-action button strip (DEBT-005 extraction).
 *
 * Flat horizontal strip of contextual action buttons. No Card chrome.
 * Props mirror the subset of DashboardPageProps the section actually consumes.
 */
import { BarChart3, FileText, Key, Rocket, Sparkles, Target } from 'lucide-react';

import { Link } from '@inertiajs/react';

import { Button } from '@/Components/ui/button';
import { EmptyState } from '@/Components/ui/empty-state';
import { EMPTY_TITLE } from '@/lib/emptyStateMessages';

export interface QuickActionsPanelProps {
  firstSite: { id: string; name: string; domain: string } | null | undefined;
  pendingRecommendations: number;
  hasSerpKey: boolean;
}

export function QuickActionsPanel({
  firstSite,
  pendingRecommendations,
  hasSerpKey,
}: QuickActionsPanelProps) {
  return (
    <section aria-labelledby="quick-actions-heading" className="mb-4">
      <h2 id="quick-actions-heading" className="editorial-rule left mb-4">
        Quick Actions
      </h2>

      {firstSite ? (
        <div className="flex flex-wrap gap-2">
          <Button variant="outline" size="sm" asChild>
            <Link href={route('analyze.index', firstSite.id)}>
              <BarChart3 className="mr-2 size-4" aria-hidden="true" />
              Run New Analysis
            </Link>
          </Button>
          <Button variant="outline" size="sm" asChild>
            {/* product name: "Action Queue" (route: opportunity-map.index) */}
            <Link
              href={
                // UX-206: no &draftable=1 — count and destination must match
                route('opportunity-map.index', firstSite.id) +
                '?type=recommendation'
              }
            >
              <Sparkles className="mr-2 size-4" aria-hidden="true" />
              Open Action Queue{' '}
              <span className="font-data ml-1 tabular-nums">({pendingRecommendations})</span>
            </Link>
          </Button>
          <Button variant="outline" size="sm" asChild>
            <Link href={route('content-inventory.index', firstSite.id)}>
              <FileText className="mr-2 size-4" aria-hidden="true" />
              Content Inventory
            </Link>
          </Button>
          {hasSerpKey ? (
            <Button variant="outline" size="sm" asChild>
              <Link href={route('pipeline.index', firstSite.id)}>
                <Target className="mr-2 size-4" aria-hidden="true" />
                Score Drafts with SERP
              </Link>
            </Button>
          ) : (
            <Button variant="outline" size="sm" asChild>
              <Link href={route('settings.serp')}>
                <Key className="mr-2 size-4" aria-hidden="true" />
                Set Up SERP Analysis
              </Link>
            </Button>
          )}
        </div>
      ) : (
        <EmptyState
          variant="zero"
          icon={Rocket}
          title={EMPTY_TITLE.firstSite}
          description="Add your first site to see quick actions."
          primaryAction={{ label: 'Add Site', href: route('sites.create') }}
        />
      )}
    </section>
  );
}
