import { ConnectionTestResult, TableInfo } from "../types/externalDbTypes";

export interface ConnectionConfig {
  host: string;
  port: number;
  database: string;
  user: string;
  password: string;
  connectionTimeoutMillis?: number;
  queryTimeoutMillis?: number;
  ssl?: boolean | { rejectUnauthorized: boolean };
}

export interface QueryResult {
  rows: any[];
  rowCount?: number;
  fields?: any[];
  affectedRows?: number; // MySQL/MariaDB용
  length?: number; // 배열 형태로 반환되는 경우
}

export interface DatabaseConnector {
  connect(): Promise<void>;
  disconnect(): Promise<void>;
  testConnection(): Promise<ConnectionTestResult>;
  executeQuery(query: string, params?: any[]): Promise<QueryResult>; // params 추가
  getTables(): Promise<TableInfo[]>;
  getColumns(tableName: string): Promise<any[]>; // 특정 테이블의 컬럼 정보 조회
}
