import { basic as request } from '@/api/request';

/**
 * @description 清理模型
 * @url /bpm/model/clean
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmModelClean<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  params: API.postBpmModelCleanParams,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>(
    '/bpm/model/clean',
    {},
    {
      params: {
        ...params,
      },
      ...(options || {}),
    },
  );
}

/**
 * @description 新建模型
 * @url /bpm/model/create
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmModelCreate<
  R = API.ResponseDataString,
  T = API.ResponseDataString,
>(
  body: API.BpmModelSaveReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/model/create', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 删除模型
 * @url /bpm/model/delete
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmModelDelete<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  params: API.postBpmModelDeleteParams,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>(
    '/bpm/model/delete',
    {},
    {
      params: {
        ...params,
      },
      ...(options || {}),
    },
  );
}

/**
 * @description 部署模型
 * @url /bpm/model/deploy
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmModelDeploy<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  params: API.postBpmModelDeployParams,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>(
    '/bpm/model/deploy',
    {},
    {
      params: {
        ...params,
      },
      ...(options || {}),
    },
  );
}

/**
 * @description 获得模型
 * @url /bpm/model/get
 * @method GET
 * @author @pubinfo/openapi
 */
export function getBpmModelGet<
  R = API.ResponseDataBpmModelRespVO,
  T = API.ResponseDataBpmModelRespVO,
>(
  params: API.getBpmModelGetParams,
  options?: Parameters<typeof request.Get<R, T>>[1],
) {
  return request.Get<R, T>('/bpm/model/get', {
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/**
 * @description 获得模型分页
 * @url /bpm/model/list
 * @method GET
 * @author @pubinfo/openapi
 */
export function getBpmModelList<
  R = API.ResponseDataListBpmModelRespVO,
  T = API.ResponseDataListBpmModelRespVO,
>(
  params: API.getBpmModelListParams,
  options?: Parameters<typeof request.Get<R, T>>[1],
) {
  return request.Get<R, T>('/bpm/model/list', {
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/**
 * @description 获得仿钉钉流程设计模型
 * @url /bpm/model/simple/get
 * @method GET
 * @author @pubinfo/openapi
 */
export function getBpmModelSimpleGet<
  R = API.ResponseDataBpmSimpleModelNodeVO,
  T = API.ResponseDataBpmSimpleModelNodeVO,
>(
  params: API.getBpmModelSimpleGetParams,
  options?: Parameters<typeof request.Get<R, T>>[1],
) {
  return request.Get<R, T>('/bpm/model/simple/get', {
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/**
 * @description 保存仿钉钉流程设计模型
 * @url /bpm/model/simple/update
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmModelSimpleUpdate<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmSimpleModelUpdateReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/model/simple/update', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 修改模型
 * @url /bpm/model/update
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmModelUpdate<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmModelSaveReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/model/update', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 修改模型的 BPMN
 * @url /bpm/model/update-bpmn
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmModelUpdateBpmn<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmModeUpdateBpmnReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/model/update-bpmn', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 批量修改模型排序
 * @url /bpm/model/update-sort-batch
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmModelUpdateSortBatch<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  params: API.postBpmModelUpdateSortBatchParams,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>(
    '/bpm/model/update-sort-batch',
    {},
    {
      params: {
        ...params,
      },
      ...(options || {}),
    },
  );
}

/**
 * @description 修改模型的状态 实际更新的部署的流程定义的状态
 * @url /bpm/model/update-state
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmModelUpdateState<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmModelUpdateStateReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/model/update-state', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}
