/**
 * KRA - Database Init API Service
 */
import request from '@/utils/request';

export interface InitDBParams {
  dbType: string;
  host: string;
  port: string;
  userName: string;
  password: string;
  dbName: string;
  config?: string;
}

export interface CheckDBResult {
  needInit: boolean;
}

/** 初始化数据库 */
export const initDB = (data: InitDBParams) => {
  return request.post<any>('/init/initdb', data);
};

/** 检查数据库是否需要初始化 */
export const checkDB = () => {
  return request.post<CheckDBResult>('/init/checkdb');
};

export default {
  initDB,
  checkDB,
};
