import http from '../scan/httpUtil';

const baseUrl = '/api';
import { scan, modelScanTask, equipScanTask, dataCenter } from './../scan/config';


/**
 * info: 查询统计数量(查询总数量不传参数，查询已完成数量TaskState=0，查询未找到TaskState=-1，查询未验证TaskState=1)
 * @param {Filters:string} param 查询参数
 * @param {*} success  成功的回调函数
 *
 */
export function queryTaskCount(param, success) {
  // let url = `${baseUrl}${dataCenter}/scan-task-base/count`;
  let url = `${scan}/task/aggregate/count`;
  http.postJson(url, param, success);
}

/*************************模型任务接口****************************/
//创建模型任务
export function createModelTask(param, success) {
  let url = `${baseUrl}${modelScanTask}/create`;
  http.postJson(url, param, success);
}

//根据id删除模型任务
export function deleteModelTask(param, success) {
  let url = `${baseUrl}${modelScanTask}/delete`;
  http.postJson(url, param, success);
}

//查询：根据模型空间ID查询设备信息
export function queryModelDiglog(param, success) {
  let url = `${baseUrl}${modelScanTask}/equip-query`;
  http.postJson(url, param, success);
}

//查询模型任务
export function queryModelTask(param, success) {
  // let url = `${baseUrl}${modelScanTask}/page-query`;
  let url = `${baseUrl}${scan}/task/model/page-query`;
  http.postJson(url, param, success);
}

//更新模型任务
export function updateModelTask(param, success) {
  let url = `${baseUrl}${modelScanTask}/update`;
  http.postJson(url, param, success);
}

//查询设备分类
export function queryModelCategory(param, success) {
  // let url = `${baseUrl}${modelScanTask}/model-category-query`;
  let url = `${baseUrl}${scan}/task/model/model-category-query`;
  http.postJson(url, param, success);
}

//查询模型文件夹和文件
export function queryModelFile(param, success) {
  let url = `${baseUrl}${scan}/task/model/model-file-query`;
  // let url = `${scan}/task/model/model-file-query`;
  http.postJson(url, param, success);
}

//查询模型任务下的部件类型及数量
export function modelCategoryCount(param, success) {
  let url = `${baseUrl}${modelScanTask}/category-count`;
  http.postJson(url, param, success);
}

/*************************设备台账任务接口****************************/
//创建设备台账任务
export function createDeviceTask(param, success) {
  let url = `${baseUrl}${equipScanTask}/create`;
  http.postJson(url, param, success);
}

//根据id删除设备台账任务
export function deleteDeviceTask(param, success) {
  let url = `${baseUrl}${equipScanTask}/delete`;
  http.postJson(url, param, success);
}

//查询设备台账任务
export function queryDeviceTask(param, success) {
  // let url = `${baseUrl}${equipScanTask}/page-query`;
  let url = `${scan}/task/equip/page-query`;
  http.postJson(url, param, success)
}

//更新设备台账任务
export function updateDeviceTask(param, success) {
  let url = `${baseUrl}${equipScanTask}/update`;
  http.postJson(url, param, success)
}

//设备台账任务接口 查询设备分类
export function queryDeviceCategory(param, success) {
  // let url = `${baseUrl}${equipScanTask}/equip-category-query`;
  let url = `${baseUrl}${scan}/task/equip/category/query`;
  http.postJson(url, param, success)
}

//查询设备任务下的部件类型及数量
export function categoryCount(param, success) {
  let url = `${baseUrl}${equipScanTask}/category-count`
  http.postJson(url, param, success)
}

/*************************资产台账任务接口****************************/
//统计数量
export function countAssetsTask(param, success) {
  // let url = `${baseUrl}${dataCenter}/property-scan-task/count`;
  let url = `${scan}/task/property/count`;
  http.postJson(url, param, success)
}

//创建设备台账任务
export function createAssetsTask(param, success) {
  // let url = `${baseUrl}${dataCenter}/property-scan-task/create`;
  let url = `${scan}/task/property/create`;
  http.postJson(url, param, success)
}

//根据id删除设备台账任务
export function deleteAssetsTask(param, success) {
  let url = `${scan}/task/property/delete`;
  http.postJson(url, param, success)
}

//查询资产台账任务 y
export function queryAssetsTask(param, success) {
  // let url = `${baseUrl}${dataCenter}/property-scan-task/page-query`;
  let url = `${scan}/task/property/page-query`;
  http.postJson(url, param, success)
}

//更新资产台账任务
export function updateAssetsTask(param, success) {
  let url = `${scan}/task/property/update`;
  http.postJson(url, param, success)
}

//查询设备族
export function queryAssetsFamily(param, success) {
  // let url = `${baseUrl}${dataCenter}/property-scan-task/property-category-query`;
  let url = `${scan}/task/property/property-category-query`;
  http.postJson(url, param, success)
}
