/**
 * 완료함 타입 정의
 * 결재가 완료된 문서 (승인/반려/전결)
 */

// ===== 메인 탭 타입 =====
export type CompletedTabType = 'all' | 'approved' | 'rejected';

// 완료 유형
export type CompletedStatus = 'approved' | 'rejected';

// 결재 유형 (문서 종류)
export type ApprovalType = 'expense_report' | 'proposal' | 'expense_estimate' | 'document';

// 필터 옵션
export type FilterOption = 'all' | 'expense_report' | 'proposal' | 'expense_estimate' | 'document';

export const FILTER_OPTIONS: { value: FilterOption; label: string }[] = [
  { value: 'all', label: '전체' },
  { value: 'expense_report', label: '지출결의서' },
  { value: 'proposal', label: '품의서' },
  { value: 'expense_estimate', label: '비용견적서' },
  { value: 'document', label: '문서 결재' },
];

// 정렬 옵션
export type SortOption = 'latest' | 'oldest';

export const SORT_OPTIONS: { value: SortOption; label: string }[] = [
  { value: 'latest', label: '최신순' },
  { value: 'oldest', label: '오래된순' },
];

// ===== 완료 문서 레코드 =====
export interface CompletedRecord {
  id: string;
  documentNo: string;
  approvalType: ApprovalType;
  formCode?: string;             // 양식코드
  formName?: string;             // 양식명
  title: string;
  draftDate: string;
  drafter: string;
  drafterDepartment: string;
  drafterPosition: string;
  completedDate: string;       // 완료일시
  completedBy: string;         // 최종 처리자
  status: CompletedStatus;
  createdAt: string;
  updatedAt: string;
}

// ===== 상수 정의 =====

export const COMPLETED_TAB_LABELS: Record<CompletedTabType, string> = {
  all: '전체',
  approved: '승인',
  rejected: '반려',
};

export const APPROVAL_TYPE_LABELS: Record<ApprovalType, string> = {
  expense_report: '지출결의서',
  proposal: '품의서',
  expense_estimate: '비용견적서',
  document: '문서 결재',
};

export const COMPLETED_STATUS_LABELS: Record<CompletedStatus, string> = {
  approved: '승인',
  rejected: '반려',
};

export const COMPLETED_STATUS_COLORS: Record<CompletedStatus, string> = {
  approved: 'bg-green-100 text-green-800',
  rejected: 'bg-red-100 text-red-800',
};
