import request from '@/utils/request'

// 查询AI工作流列表
export function listWorkflow(query) {
  return request({
    url: '/his/aiWorkflow/list',
    method: 'get',
    params: query
  })
}

// 查询AI工作流详细
export function getWorkflow(workflowId) {
  return request({
    url: '/his/aiWorkflow/' + workflowId,
    method: 'get'
  })
}

// 新增AI工作流
export function addWorkflow(data) {
  return request({
    url: '/his/aiWorkflow/save',
    method: 'post',
    data: data
  })
}

// 修改AI工作流
export function updateWorkflow(data) {
  return request({
    url: '/his/aiWorkflow/save',
    method: 'post',
    data: data
  })
}

// 修改AI工作流状态
export function updateWorkflowStatus(workflowId, status) {
  return request({
    url: '/his/aiWorkflow/status/' + workflowId + '/' + status,
    method: 'put'
  })
}

// 删除AI工作流
export function delWorkflow(workflowId) {
  return request({
    url: '/his/aiWorkflow/' + workflowId,
    method: 'delete'
  })
}

// 复制AI工作流
export function copyWorkflow(workflowId) {
  return request({
    url: '/his/aiWorkflow/copy/' + workflowId,
    method: 'post'
  })
}

// 获取节点类型列表
export function getNodeTypes() {
  return request({
    url: '/his/aiWorkflow/nodeTypes',
    method: 'get'
  })
}

// 导出AI工作流
export function exportWorkflow(query) {
  return request({
    url: '/his/aiWorkflow/export',
    method: 'get',
    params: query
  })
}

// 根据workflowId获取绑定的销售列表
export function getBindCompanyUserByWorkflowId(workflowId) {
  return request({
    url: '/his/aiWorkflow/getBindCompanyUserByWorkflowId/' + workflowId,
    method: 'get'
  })
}

// 获取销售列表
export function listCompanyUser() {
  return request({
    url: '/his/aiWorkflow/listCompanyUser',
    method: 'get'
  })
}

// 检查销售是否已被绑定
export function checkCompanyUserBeUsed(companyUserId) {
  return request({
    url: '/his/aiWorkflow/checkCompanyUserBeUsed/' + companyUserId,
    method: 'get'
  })
}

// 更新工作流绑定销售
export function updateWorkflowBindCompanyUser(data) {
  return request({
    url: '/his/aiWorkflow/updateWorkflowBindCompanyUser',
    method: 'post',
    data: data
  })
}
