import request from '@/utils/request'

// 标签模板绑定API
export const tagBindingApi = {
  // 获取绑定列表
  getList: (params) => {
    return request({
      url: '/workflow/tag-binding/list',
      method: 'get',
      params
    })
  },
    getListByStatus: (params) => {
    return request({
      url: '/workflow/tag-binding/listByStatus',
      method: 'get',
      params
    })
  },

  // 根据ID获取
  getById: (id) => {
    return request({
      url: `/workflow/tag-binding/${id}`,
      method: 'get'
    })
  },

  // 创建绑定
  create: (data) => {
    return request({
      url: '/workflow/tag-binding',
      method: 'post',
      data
    })
  },

  // 更新绑定
  update: (id, data) => {
    return request({
      url: `/workflow/tag-binding/${id}`,
      method: 'put',
      data
    })
  },

  // 删除绑定
  delete: (id) => {
    return request({
      url: `/workflow/tag-binding/${id}`,
      method: 'delete'
    })
  },

  // 批量绑定
  batchBind: (templateId, tagCodes) => {
    return request({
      url: `/workflow/tag-binding/batch-bind/${templateId}`,
      method: 'post',
      data: tagCodes
    })
  },

  // 根据用户标签匹配模板
  matchTemplate: (userTags) => {
    return request({
      url: '/workflow/tag-binding/match-template',
      method: 'post',
      data: userTags
    })
  },

  // 测试标签匹配
  testMatch: (id, testTags) => {
    return request({
      url: `/workflow/tag-binding/${id}/test-match`,
      method: 'post',
      data: testTags
    })
  },

  // 批量添加龙虾标签给客户
  batchBindLobsterTag: (data) => {
    return request({
      url: '/workflow/tag-binding/batch-bind-lobster-tag',
      method: 'post',
      data
    })
  }
}
