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

export interface SysVersion {
  ID?: number;
  CreatedAt?: string;
  UpdatedAt?: string;
  version?: string;
  versionName?: string;
  versionCode?: string;
  versionContent?: string;
  versionStatus?: number;
}

/** 删除版本 */
export const deleteSysVersion = (params: { ID: number }) => {
  return request.delete<ApiResponse<any>>('/sysVersion/deleteSysVersion', { params });
};

/** 批量删除版本 */
export const deleteSysVersionByIds = (params: { IDs: number[] }) => {
  return request.delete<ApiResponse<any>>('/sysVersion/deleteSysVersionByIds', { params });
};

/** 根据ID查询版本 */
export const findSysVersion = (params: { ID: number }) => {
  return request.get<ApiResponse<{ resysVersion: SysVersion }>>('/sysVersion/findSysVersion', { params });
};

/** 分页获取版本列表 */
export const getSysVersionList = (params: PageParams) => {
  return request.get<ApiResponse<PageResult<SysVersion>>>('/sysVersion/getSysVersionList', { params });
};

/** 导出版本数据 */
export const exportVersion = (data: any) => {
  return request.post<ApiResponse<any>>('/sysVersion/exportVersion', data);
};

/** 下载版本JSON数据 */
export const downloadVersionJson = (params: { ID: number }) => {
  return request.get<Blob>('/sysVersion/downloadVersionJson', { params, responseType: 'blob' });
};

/** 导入版本数据 */
export const importVersion = (data: any) => {
  return request.post<ApiResponse<any>>('/sysVersion/importVersion', data);
};

export default {
  deleteSysVersion,
  deleteSysVersionByIds,
  findSysVersion,
  getSysVersionList,
  exportVersion,
  downloadVersionJson,
  importVersion,
};
