import { defHttp } from '/@/utils/http/axios';
import { TTransFormScriptParams } from './model/transformScriptModel';
enum TransformScriptApi {
  TransformScript_Page = '/convert',
  TransformScript_Delete_Edit = '/convert/js',
  TransformScript_ENABLE_OR_DISABLED = '/convert/update/js',
}

// 脚本转换分页查询
export const getConvertApi = (params: TTransFormScriptParams) => {
  return defHttp.get({
    url: TransformScriptApi.TransformScript_Page,
    params: {
      ...params,
      nodeType: 0,
    },
  });
};

export const deleteTransformApi = (ids: string[]) => {
  return defHttp.delete({
    url: TransformScriptApi.TransformScript_Delete_Edit,
    data: {
      ids,
    },
  });
};
export const createOrEditTransformScriptApi = (data) => {
  return defHttp.post({
    url: TransformScriptApi.TransformScript_Delete_Edit,
    data,
  });
};

export const updateTransformScriptStatusApi = (status: number, id: string) => {
  return defHttp.post({
    url: TransformScriptApi.TransformScript_ENABLE_OR_DISABLED,
    data: {
      convertIds: ['string'],
      nodeType: 0,
      status,
      id,
    },
  });
};
