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

/**
 * @description 通过任务
 * @url /bpm/task/approve
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskApprove<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmTaskApproveReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/approve', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 签收
 * @url /bpm/task/claim
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskClaim<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  params: API.postBpmTaskClaimParams,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>(
    '/bpm/task/claim',
    {},
    {
      params: {
        ...params,
      },
      ...(options || {}),
    },
  );
}

/**
 * @description 抄送任务
 * @url /bpm/task/copy
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskCopy<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmTaskCopyReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/copy', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 加签 before 前加签，after 后加签
 * @url /bpm/task/create-sign
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskCreateSign<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmTaskSignCreateReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/create-sign', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 委派任务 用于【流程详情】的【委派】按钮
 * @url /bpm/task/delegate
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskDelegate<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmTaskDelegateReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/delegate', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 减签
 * @url /bpm/task/delete-sign
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskDeleteSign<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmTaskSignDeleteReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/delete-sign', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 获取 Done 已办任务分页
 * @url /bpm/task/done-page
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskDonePage<
  R = API.ResponseDataPageDataBpmTaskRespVO,
  T = API.ResponseDataPageDataBpmTaskRespVO,
>(
  body: API.BpmTaskPageReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/done-page', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 获得指定父级任务的子任务列表
 * @url /bpm/task/list-by-parent-task-id
 * @method GET
 * @author @pubinfo/openapi
 */
export function getBpmTaskListByParentTaskId<
  R = API.ResponseDataListBpmTaskRespVO,
  T = API.ResponseDataListBpmTaskRespVO,
>(
  params: API.getBpmTaskListByParentTaskIdParams,
  options?: Parameters<typeof request.Get<R, T>>[1],
) {
  return request.Get<R, T>('/bpm/task/list-by-parent-task-id', {
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/**
 * @description 获得指定流程实例的任务列表 包括完成的、未完成的
 * @url /bpm/task/list-by-process-instance-id
 * @method GET
 * @author @pubinfo/openapi
 */
export function getBpmTaskListByProcessInstanceId<
  R = API.ResponseDataListBpmTaskRespVO,
  T = API.ResponseDataListBpmTaskRespVO,
>(
  params: API.getBpmTaskListByProcessInstanceIdParams,
  options?: Parameters<typeof request.Get<R, T>>[1],
) {
  return request.Get<R, T>('/bpm/task/list-by-process-instance-id', {
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/**
 * @description 获取所有可退回的节点 用于【流程详情】的【退回】按钮
 * @url /bpm/task/list-by-return
 * @method GET
 * @author @pubinfo/openapi
 */
export function getBpmTaskListByReturn<
  R = API.ResponseDataListBpmTaskRespVO,
  T = API.ResponseDataListBpmTaskRespVO,
>(
  params: API.getBpmTaskListByReturnParams,
  options?: Parameters<typeof request.Get<R, T>>[1],
) {
  return request.Get<R, T>('/bpm/task/list-by-return', {
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/**
 * @description 获取全部任务的分页 用于【流程任务】菜单
 * @url /bpm/task/manager-page
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskManagerPage<
  R = API.ResponseDataPageDataBpmTaskRespVO,
  T = API.ResponseDataPageDataBpmTaskRespVO,
>(
  body: API.BpmTaskPageReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/manager-page', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 不通过任务
 * @url /bpm/task/reject
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskReject<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmTaskRejectReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/reject', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 退回任务 用于【流程详情】的【退回】按钮
 * @url /bpm/task/return
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskReturn<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmTaskReturnReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/return', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 获取 Todo 待办任务分页
 * @url /bpm/task/todo-page
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskTodoPage<
  R = API.ResponseDataPageDataBpmTaskRespVO,
  T = API.ResponseDataPageDataBpmTaskRespVO,
>(
  body: API.BpmTaskPageReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/todo-page', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}

/**
 * @description 转派任务 用于【流程详情】的【转派】按钮
 * @url /bpm/task/transfer
 * @method POST
 * @author @pubinfo/openapi
 */
export function postBpmTaskTransfer<
  R = API.ResponseDataBoolean,
  T = API.ResponseDataBoolean,
>(
  body: API.BpmTaskTransferReqVO,
  options?: Parameters<typeof request.Post<R, T>>[2],
) {
  return request.Post<R, T>('/bpm/task/transfer', body, {
    headers: {
      'Content-Type': 'application/json',
    },
    ...(options || {}),
  });
}
