import request from '@/config/axios'

// 类别 VO
export interface TypesVO {
  id: number // id
  name: string // 名称
  dataId: number // 项目id
  index: number // index
  color: string // 颜色
}

// 类别 API
export const TypesApi = {
  // 查询类别分页
  getTypesPage: async (params: any) => {
    return await request.get({ url: `/annotation/types/page`, params })
  },

  // 查询类别详情
  getTypes: async (id: number) => {
    return await request.get({ url: `/annotation/types/get?id=` + id })
  },

  // 新增类别
  createTypes: async (data: TypesVO) => {
    return await request.post({ url: `/annotation/types/create`, data })
  },

  // 修改类别
  updateTypes: async (data: TypesVO) => {
    return await request.put({ url: `/annotation/types/update`, data })
  },

  // 删除类别
  deleteTypes: async (id: number) => {
    return await request.delete({ url: `/annotation/types/delete?id=` + id })
  },

  // 导出类别 Excel
  exportTypes: async (params) => {
    return await request.download({ url: `/annotation/types/export-excel`, params })
  },
}
