// ===== 문서 상세 모달 타입 정의 =====

export type DocumentType = 'proposal' | 'expenseReport' | 'expenseEstimate';

// 결재자 정보
export interface Approver {
  id: string;
  name: string;
  position: string;
  department: string;
  status: 'pending' | 'approved' | 'rejected' | 'none';
  approvedAt?: string;
}

// 품의서 데이터
export interface ProposalDocumentData {
  documentNo: string;
  createdAt: string;
  vendor: string;
  vendorPaymentDate: string;
  title: string;
  description: string;
  reason: string;
  estimatedCost: number;
  attachments?: string[];
  approvers: Approver[];
  drafter: Approver;
}

// 지출결의서 항목
export interface ExpenseReportItem {
  id: string;
  no: number;
  description: string;
  amount: number;
  note: string;
}

// 지출결의서 데이터
export interface ExpenseReportDocumentData {
  documentNo: string;
  createdAt: string;
  requestDate: string;
  paymentDate: string;
  items: ExpenseReportItem[];
  cardInfo: string;
  totalAmount: number;
  attachments?: string[];
  approvers: Approver[];
  drafter: Approver;
}

// 지출 예상 내역서 항목
export interface ExpenseEstimateItem {
  id: string;
  expectedPaymentDate: string;
  category: string;
  amount: number;
  vendor: string;
  account: string;
}

// 지출 예상 내역서 데이터
export interface ExpenseEstimateDocumentData {
  documentNo: string;
  createdAt: string;
  items: ExpenseEstimateItem[];
  totalExpense: number;
  accountBalance: number;
  finalDifference: number;
  approvers: Approver[];
  drafter: Approver;
}

// 문서 상세 모달 모드
export type DocumentDetailMode = 'draft' | 'inbox' | 'reference';

// 문서 상태 (기안함 기준)
export type DocumentStatus = 'draft' | 'pending' | 'approved' | 'rejected';

// 문서 상세 모달 Props
export interface DocumentDetailModalProps {
  open: boolean;
  onOpenChange: (open: boolean) => void;
  documentType: DocumentType;
  data: ProposalDocumentData | ExpenseReportDocumentData | ExpenseEstimateDocumentData;
  mode?: DocumentDetailMode; // 'draft': 기안함 (상신), 'inbox': 결재함 (승인/반려)
  documentStatus?: DocumentStatus; // 문서 상태 (임시저장일 때만 수정/상신 가능)
  onEdit?: () => void;
  onCopy?: () => void;
  onApprove?: () => void;
  onReject?: () => void;
  onSubmit?: () => void; // 상신 콜백
}