import request from '@/utils/request'

export function getWorkflowList(query) {
  return request({
    url: '/wf/workflow/',
    method: 'get',
    params: query
  })
}
export function createWorkflow(data) {
  return request({
    url: '/wf/workflow/',
    method: 'post',
    data
  })
}
export function updateWorkflow(id, data) {
  return request({
    url: `/wf/workflow/${id}/`,
    method: 'put',
    data
  })
}
export function deleteWorkflow(id, data) {
  return request({
    url: `/wf/workflow/${id}/`,
    method: 'delete',
    data
  })
}
//流转状态列表
export function getWfStateList(id) {
  return request({
    url: `/wf/workflow/${id}/states`,
    method: 'get'
  })
}
//流转状态创建
export function createWfState(data) {
  return request({
    url: '/wf/state/',
    method: 'post',
    data
  })
}
//流转状态更新
export function updateWfState(id, data) {
  return request({
    url: `/wf/state/${id}/`,
    method: 'put',
    data
  })
}
//流转状态删除
export function deleteWfState(id, data) {
  return request({
    url: `/wf/state/${id}/`,
    method: 'delete',
    data
  })
}
//自定义字段列表
export function getWfCustomfieldList(id) {
  return request({
    url: `/wf/workflow/${id}/customfields`,
    method: 'get'
  })
}
//自定义字段创建
export function createWfCustomfield(data) {
  return request({
    url: '/wf/customfield/',
    method: 'post',
    data
  })
}
//自定义字段更新
export function updateWfCustomfield(id, data) {
  return request({
    url: `/wf/customfield/${id}/`,
    method: 'put',
    data
  })
}
//自定义字段删除
export function deleteWfCustomfield(id, data) {
  return request({
    url: `/wf/customfield/${id}/`,
    method: 'delete',
    data
  })
}
//流转列表
export function getWfTransitionList(id) {
  return request({
    url: `/wf/workflow/${id}/transitions/`,
    method: 'get'
  })
}
//流转创建
export function createWfTransition(data) {
  return request({
    url: '/wf/transition/',
    method: 'post',
    data
  })
}
//流转更新
export function updateWfTransition(id, data) {
  return request({
    url: `/wf/transition/${id}/`,
    method: 'put',
    data
  })
}
//流转删除
export function deleteWfTransition(id, data) {
  return request({
    url: `/wf/transition/${id}/`,
    method: 'delete',
    data
  })
}