// 배치 실행 로그 타입 정의
// 작성일: 2024-12-24

export interface BatchExecutionLog {
  id?: number;
  batch_config_id: number;
  company_code?: string;
  execution_status: 'RUNNING' | 'SUCCESS' | 'FAILED' | 'CANCELLED' | 'PARTIAL';
  start_time: Date;
  end_time?: Date | null;
  duration_ms?: number | null;
  total_records?: number | null;
  success_records?: number | null;
  failed_records?: number | null;
  error_message?: string | null;
  error_details?: string | null;
  server_name?: string | null;
  process_id?: string | null;
}

export interface CreateBatchExecutionLogRequest {
  batch_config_id: number;
  company_code?: string;
  execution_status: 'RUNNING' | 'SUCCESS' | 'FAILED' | 'CANCELLED' | 'PARTIAL';
  start_time?: Date;
  end_time?: Date | null;
  duration_ms?: number | null;
  total_records?: number | null;
  success_records?: number | null;
  failed_records?: number | null;
  error_message?: string | null;
  error_details?: string | null;
  server_name?: string | null;
  process_id?: string | null;
}

export interface UpdateBatchExecutionLogRequest {
  execution_status?: 'RUNNING' | 'SUCCESS' | 'FAILED' | 'CANCELLED' | 'PARTIAL';
  end_time?: Date | null;
  duration_ms?: number | null;
  total_records?: number | null;
  success_records?: number | null;
  failed_records?: number | null;
  error_message?: string | null;
  error_details?: string | null;
}

export interface BatchExecutionLogFilter {
  batch_config_id?: number;
  execution_status?: string;
  start_date?: Date;
  end_date?: Date;
  page?: number;
  limit?: number;
}

export interface BatchExecutionLogWithConfig extends BatchExecutionLog {
  batch_config?: {
    id: number;
    batch_name: string;
    description?: string | null;
    cron_schedule: string;
    is_active?: string | null;
  };
}

