'use client';

/**
 * 제품검사요청서 모달
 * DocumentViewer를 사용하여 문서 표시 + 인쇄/PDF 기능 제공
 */

import { DocumentViewer } from '@/components/document-system';
import { InspectionRequestDocument } from './InspectionRequestDocument';
import type { InspectionRequestDocument as InspectionRequestDocumentType } from '../types';

interface InspectionRequestModalProps {
  open: boolean;
  onOpenChange: (open: boolean) => void;
  data: InspectionRequestDocumentType | null;
}

export function InspectionRequestModal({
  open,
  onOpenChange,
  data,
}: InspectionRequestModalProps) {
  if (!data) return null;

  return (
    <DocumentViewer
      title="제품검사요청서"
      preset="readonly"
      open={open}
      onOpenChange={onOpenChange}
      pdfMeta={{
        documentNumber: data.documentNumber,
        createdDate: data.createdDate,
      }}
    >
      <InspectionRequestDocument data={data} />
    </DocumentViewer>
  );
}
