import http from '@/utils/request'

// n8n Workflow 适配接口。DataFlow 定义接口位于 dataGovernance.js。
export function getWorkflows (params) {
  return http.get('/datafactory/workflows', params)
}

export function getWorkflow (workflowId) {
  return http.get(`/datafactory/workflows/${workflowId}`)
}

export function getWorkflowStatus (workflowId) {
  return http.get(`/datafactory/workflows/${workflowId}/status`)
}

export function activateWorkflow (workflowId) {
  return http.post(`/datafactory/workflows/${workflowId}/activate`)
}

export function deactivateWorkflow (workflowId) {
  return http.post(`/datafactory/workflows/${workflowId}/deactivate`)
}

export function getWorkflowExecutions (workflowId, params) {
  return http.get(`/datafactory/workflows/${workflowId}/executions`, params)
}

export function getAllExecutions (params) {
  return http.get('/datafactory/executions', params)
}

export function getExecution (executionId) {
  return http.get(`/datafactory/executions/${executionId}`)
}

export function triggerWorkflow (workflowId, data) {
  return http.post(`/datafactory/workflows/${workflowId}/execute`, data)
}

export function healthCheck () {
  return http.get('/datafactory/health')
}
