// 수집 관리 관련 타입 정의
// 작성일: 2024-12-23

export interface DataCollectionConfig {
  id?: number;
  config_name: string;
  description?: string | null;
  source_connection_id: number;
  source_table: string;
  target_table?: string | null;
  collection_type: string;
  schedule_cron?: string | null;
  is_active: string; // 'Y' | 'N'
  last_collected_at?: Date | null;
  collection_options?: Record<string, any> | null;
  created_date?: Date | null;
  created_by?: string | null;
  updated_date?: Date | null;
  updated_by?: string | null;
  company_code: string;
}

export interface CollectionFilter {
  config_name?: string;
  source_connection_id?: number;
  collection_type?: string;
  is_active?: string;
  company_code?: string;
  search?: string;
}

export interface CollectionJob {
  id?: number;
  config_id: number;
  job_status: string;
  started_at?: Date | null;
  completed_at?: Date | null;
  records_processed?: number | null;
  error_message?: string | null;
  job_details?: Record<string, any> | null;
  created_date?: Date | null;
}

export interface CollectionHistory {
  id?: number;
  config_id: number;
  collection_date: Date;
  records_collected: number;
  execution_time_ms: number;
  status: string;
  error_details?: string | null;
  created_date?: Date | null;
}

// 수집 타입 옵션
export const COLLECTION_TYPE_OPTIONS = [
  { value: 'full', label: '전체 수집' },
  { value: 'incremental', label: '증분 수집' },
  { value: 'delta', label: '변경분 수집' },
];

// 작업 상태 옵션
export const JOB_STATUS_OPTIONS = [
  { value: 'pending', label: '대기 중' },
  { value: 'running', label: '실행 중' },
  { value: 'completed', label: '완료' },
  { value: 'failed', label: '실패' },
];

export interface ApiResponse<T> {
  success: boolean;
  data?: T;
  message?: string;
  error?: string;
}
