'use client' import React from 'react' import { cn } from '../../../utils/cn' import { SparklesIcon } from '../../icons/sparkles-icon' import { AIEnrichButton } from './AIEnrichButton' import { AIWarningsSection } from './AIWarningsSection' import { Button } from '../../ui/button' import { Badge } from '../../ui/badge' import { Textarea } from '../../ui/textarea' import { CheckCircle, AlertCircle, Loader2, X } from 'lucide-react' export interface ConfidenceField { label: string key: string confidence?: number } /** * Represents a field required for AI enrichment. * Used to drive both the canEnrich logic and display of AI-required badges. */ export interface AIRequiredField { /** Form field key (e.g., 'version', 'email') */ key: string /** Display label (e.g., 'Version', 'Email') */ label: string /** Current state - is field filled? */ isFilled: boolean } export interface AIEnrichSectionProps { // Button state onEnrich: () => void loading?: boolean disabled?: boolean canEnrich?: boolean // Status status?: 'idle' | 'loading' | 'success' | 'error' statusMessage?: string overallConfidence?: number // Warnings warnings?: string[] // Confidence fields to display (optional - shown as simple list) confidenceFields?: ConfidenceField[] // Required fields for AI enrichment - displays missing fields when disabled requiredFields?: AIRequiredField[] // Custom content (like created tags info) children?: React.ReactNode /** * Settings panel rendered INSIDE the card, between the header and the action * button (same slot the custom-instructions block occupies). Combined * sections (clips, highlight) pass their config here so it sits under the * title that names it — rendered ABOVE the card, a config panel reads as * belonging to whatever section happens to precede it. */ configSlot?: React.ReactNode // Actions onClear?: () => void showClearButton?: boolean onCancel?: () => void showCancel?: boolean isCancelling?: boolean // Labels title?: string description?: string buttonLabel?: string loadingLabel?: string disabledMessage?: string // Styling variant?: 'default' | 'compact' className?: string icon?: React.ReactNode // Editor-provided custom instructions textarea (opt-in). // When showCustomInstructions is true, a controlled