import mssqlIcon from './mssql.svg';
import mysqlIcon from './mysql.svg';
import oracleIcon from './oracle.svg';
import psqlIcon from './psql.svg';

const DB_TYPE_ICON_MAP: Record<string, string> = {
  mysql: mysqlIcon,
  postgresql: psqlIcon,
  postgres: psqlIcon,
  psql: psqlIcon,
  sqlserver: mssqlIcon,
  mssql: mssqlIcon,
  oracle: oracleIcon,
};

/**
 * 根据数据库类型获取对应 SVG 图标路径
 */
export function getDatabaseTypeIcon(dbType?: string): string {
  if (!dbType) {
    return psqlIcon;
  }
  const normalized = dbType.toLowerCase().trim();
  return DB_TYPE_ICON_MAP[normalized] || psqlIcon;
}

export { mssqlIcon, mysqlIcon, oracleIcon, psqlIcon };
