import request from '@/config/axios'

// 标注 VO
export interface MarkVO {
}


// 项目数据 VO
export interface DataVO {
  id: number
  name: string
  description: string
  createTime: string
  path: string
  count: number
  status: string
  type: string
  progress: number
}

// 图片标注 VO
export interface ImageMarkVO {
  id: number
  path: string
  dataId: number
  annotation: Array<{
    class_id: number
    center_x: number
    center_y: number
    width: number
    height: number
    polygon_points: string
    angle: string
  }>
  status: number
  createTime: string
}

// 标注类型 VO
export interface AnnotationTypeVO {
  id: number
  name: string
  color: string
  dataId: number
  index: number
  createTime: string
}

// 标注 API
export const MarkApi = {
  // 查询标注分页
  getMarkPage: async (params: any) => {
    return await request.get({ url: `/annotation/mark/page`, params })
  },

  // 查询标注详情
  getMark: async (id: number) => {
    return await request.get({ url: `/annotation/mark/get?id=` + id })
  },

  // 新增标注
  createMark: async (data: MarkVO) => {
    return await request.post({ url: `/annotation/mark/create`, data })
  },

  // 修改标注
  updateMark: async (data: MarkVO) => {
    return await request.put({ url: `/annotation/mark/update`, data })
  },

  // 删除标注
  deleteMark: async (id: number) => {
    return await request.delete({ url: `/annotation/mark/delete?id=` + id })
  },

  // 导出标注 Excel
  exportMark: async (params) => {
    return await request.download({ url: `/annotation/mark/export-excel`, params })
  },
   // 获取图片列表
  getImageList: async (data: { dataId: number }) => {
    return await request.post({ url: `/annotation/mark/list`, data })
  },
   // 获取标注类型列表
  getTypeList: async (data: { dataId: number }) => {
    return await request.post({ url: `/annotation/types/list`, data })
  },
  updateImageStatus: async (data: { id: number; status: number }) => {
    return await request.put({ url: `/annotation/mark/update-status`, data })
  },

   // 获取标注类型列表
  getProjectList: async () => {
    return await request.post({ url: `/annotation/datas/list` })
  },
  
   // 获取标注类型列表
  getProjectStatusList: async (data: { status: number }) => {
    return await request.post({ url: `/annotation/datas/listStatus`,data })
  },
  // 创建标注类型
  createType: async (data: Partial<AnnotationTypeVO>) => {
    return await request.post({ url: `/annotation/types/create`, data })
  },

  // 删除标注类型
  deleteType: async (id: number) => {
    return await request.delete({ url: `/annotation/types/delete?id=${id}` })
  },




  // 获取标注详细列表
  getMarkInfoList: async (id: number) => {
    return await request.post({ url: `/annotation/markInfo/list?markId=${id}` })
  },
    // 创建标注类型
  createMarkInfo: async (data ) => {
    return await request.post({ url: `/annotation/markInfo/create`, data })
  },

  // 删除标注类型
  deleteMarkInfo: async (id: number) => {
    return await request.delete({ url: `/annotation/markInfo/delete?id=${id}` })
  },



  // 获取标注详细列表
  updateMarkInfo: async () => {
    return await request.put({ url: `/annotation/markInfo/update` })
  },

}
