'use client';

/**
 * 입고증 다이얼로그
 *
 * document-system 통합 버전 (2026-01-22)
 */

import { Download } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { DocumentViewer } from '@/components/document-system';
import type { ReceivingDetail } from './types';
import { ReceivingReceiptContent } from './ReceivingReceiptContent';

interface Props {
  open: boolean;
  onOpenChange: (open: boolean) => void;
  detail: ReceivingDetail;
}

export function ReceivingReceiptDialog({ open, onOpenChange, detail }: Props) {
  const handleDownload = () => {
    // TODO: PDF 다운로드 기능
  };

  const toolbarExtra = (
    <Button variant="outline" size="sm" onClick={handleDownload}>
      <Download className="w-4 h-4 mr-1" />
      다운로드
    </Button>
  );

  return (
    <DocumentViewer
      title="입고증"
      subtitle={`${detail.supplier} (${detail.orderNo})`}
      preset="inspection"
      open={open}
      onOpenChange={onOpenChange}
      toolbarExtra={toolbarExtra}
    >
      <ReceivingReceiptContent data={detail} />
    </DocumentViewer>
  );
}
