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

/**
 * @description 获得流程定义
 * @url /bpm/process-definition/get
 * @method GET
 * @author @pubinfo/openapi
 */
export function getBpmProcessDefinitionGet<
  R = API.ResponseDataBpmProcessDefinitionRespVO,
  T = API.ResponseDataBpmProcessDefinitionRespVO,
>(
  params: API.getBpmProcessDefinitionGetParams,
  options?: Parameters<typeof request.Get<R, T>>[1],
) {
  return request.Get<R, T>('/bpm/process-definition/get', {
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/**
 * @description 获得流程定义列表
 * @url /bpm/process-definition/list
 * @method GET
 * @author @pubinfo/openapi
 */
export function getBpmProcessDefinitionList<
  R = API.ResponseDataListBpmProcessDefinitionRespVO,
  T = API.ResponseDataListBpmProcessDefinitionRespVO,
>(
  params: API.getBpmProcessDefinitionListParams,
  options?: Parameters<typeof request.Get<R, T>>[1],
) {
  return request.Get<R, T>('/bpm/process-definition/list', {
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/**
 * @description 获得流程定义分页
 * @url /bpm/process-definition/page
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmProcessDefinitionPage<
  R = API.ResponseDataPageDataBpmProcessDefinitionRespVO,
  T = API.ResponseDataPageDataBpmProcessDefinitionRespVO,
>(
  body: API.BpmProcessDefinitionPageReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/process-definition/page', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 获得流程定义精简列表 只包含未挂起的流程，主要用于前端的下拉选项
 * @url /bpm/process-definition/simple-list
 * @method GET
 * @author @pubinfo/openapi
 */
export function getBpmProcessDefinitionSimpleList<
  R = API.ResponseDataListBpmProcessDefinitionRespVO,
  T = API.ResponseDataListBpmProcessDefinitionRespVO,
>(options?: Parameters<typeof request.Get<R, T>>[1]) {
  return request.Get<R, T>('/bpm/process-definition/simple-list', {
    ...(options || {}),
  });
}
