//import request from '@/utils/request';
import { useHttp } from '@crami/http';
import { commonApi } from '@remote/icpx-platform/commonApi';
/* import { commonApi } from '@/api/commonApi/index'; */

export interface MetaData {
  type: string;
  productLine: string;
  name: string;
}

export async function getGeneralQueryData(params: MetaData) {
  return useHttp({
    url: commonApi().studioCache.getMetaInfo.url,
    method: commonApi().studioCache.getMetaInfo.method,
    params,
  });
}

// 获取生命周期状态分组
export async function getLiftStatusList(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeStatus/getLifeStatusList',
    method: 'post',
    params,
  });
}

// 获取生命周期详情
export async function getLiftCycleInfo(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeCycle/getLifeCircleById',
    method: 'post',
    params,
  });
}

// 获取使用对象数据
export async function getModelList(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeCycle/getModelList',
    method: 'post',
    params,
  });
}

// 保存生命周期
export async function saveLifeCircleData(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeCycle/saveLifeCircleData',
    method: 'post',
    params,
  });
}
// 删除生命周期
export async function deleteLifeCircleDatas(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeCycle/deleteLifeCircleData',
    method: 'post',
    params,
  });
}
// 删除生命周期校验
export async function deleteLifeCircleCheck(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeCycle/deleteLifeCircleCheck',
    method: 'post',
    params,
  });
}
//删除状态列表
export async function deleteState(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeStatus/deleteLifeStatus',
    method: 'post',
    params,
  });
}

//删除状态列表校验
export async function checkDeleteState(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeStatus/checkDelete',
    method: 'post',
    params,
  });
}

// 获取节点插件数据
export async function getLifeCyclePlugins(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeStatus/getLifeCyclePlugins',
    method: 'post',
    params,
  });
}
//获取状态分类下拉列表
export async function getStateTypeList(params: any) {
  return useHttp({
    //commonApi().system.getSltData.url
    url: commonApi().system.getSltData.url,
    method: commonApi().system.getSltData.method,
    params,
  });
}
//保存生命周期状态
export async function saveState(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeStatus/saveLifeStatus',
    method: 'post',
    params,
  });
}
//获取多语言列表
export async function getLangList(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeStatus/getMutilLanuageList',
    method: 'post',
    params,
  });
}
//上传文件
export async function uploadFile(data: any) {
  return useHttp({
    url: '/api/file/applicationFile/upload',
    method: 'post',
    data,
  });
}
//获取单条数据
export async function getData(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeStatus/getSingleData',
    method: 'post',
    params,
  });
}
//ID唯一性校验
export async function checkIDUnique(params: any) {
  return useHttp({
    url: '/api/lifecycle/lifeStatus/checkObjectUnique',
    method: 'post',
    params,
  });
}
