'use client';
import dynamic from 'next/dynamic';
import type { DocumentSigner } from '@/lib/db/schema';

const PdfViewer = dynamic(() => import('./PdfViewer').then(m => m.PdfViewer), { ssr: false });

export function PdfViewerWrapper({
  docId,
  docStatus,
  onFieldsChanged,
  selectedFieldId,
  textFillData,
  onFieldSelect,
  onFieldValueChange,
  aiPlacementKey,
  signers,
  unassignedFieldIds,
}: {
  docId: string;
  docStatus?: string;
  onFieldsChanged?: () => void;
  selectedFieldId?: string | null;
  textFillData?: Record<string, string>;
  onFieldSelect?: (fieldId: string | null) => void;
  onFieldValueChange?: (fieldId: string, value: string) => void;
  aiPlacementKey?: number;
  signers?: DocumentSigner[];
  unassignedFieldIds?: Set<string>;
}) {
  return (
    <PdfViewer
      docId={docId}
      docStatus={docStatus}
      onFieldsChanged={onFieldsChanged}
      selectedFieldId={selectedFieldId}
      textFillData={textFillData}
      onFieldSelect={onFieldSelect}
      onFieldValueChange={onFieldValueChange}
      aiPlacementKey={aiPlacementKey}
      signers={signers}
      unassignedFieldIds={unassignedFieldIds}
    />
  );
}
