import {request} from '@/utils/request.js'

/**
 * 启动Workflow
 * @param wfDefId
 * @returns
 */
export function startWorkflow(wfDefId) {
  return request({
    url: `/wf/start/${wfDefId}`,
    method: 'GET'
  })
}

export function getWorkflowById(wfInsId) {
  return request({
    url: `/wf/getIns/${wfInsId}`,
    method: 'GET'
  })
}

export function getWorkflowById2(wfInsId, activityInsId) {
  return request({
    url: `/wf/getIns/${wfInsId}/${activityInsId}`,
    method: 'GET'
  })
}

export function getWorkflowById3(wfInsId, activityInsId, actionInsId) {
  return request({
    url: `/wf/getIns/${wfInsId}/${activityInsId}/${actionInsId}`,
    method: 'GET'
  })
}

export function getWorkflowDetailsById(wfInsId) {
  return request({
    url: `/wf/details/${wfInsId}`,
    method: 'GET'
  })
}

export function getWorkflowRecordById(wfInsId) {
  return request({
    url: `/wf/record/${wfInsId}`,
    method: 'GET'
  })
}

/**
 * 处理
 * @param data
 * @returns
 */
export function handleWorkflow(data) {
  return request({
    url: `/wf/handle`,
    method: 'POST',
    data
  })
}

/**
 * 撤消
 * @param wfInsId
 * @returns
 */
export function cancelWorkflow(wfInsId) {
  return request({
    url: `/wf/cancel/${wfInsId}`,
    method: 'GET'
  })
}
