import { ResPage, AnnoLabeling, Clause, DataAnno } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 标注-数据标注
 */
// 获取列表
export const getAnnoLabelingList = (params: AnnoLabeling.ReqAnnoLabelingParams) => {
  return http.get<ResPage<Clause.ClauseInfo>>(PORT1 + `/article/anno/list`, params);
};

// 获取分页信息
export const getPageNumInfo = (params: AnnoLabeling.ReqPageNumInfoParams) => {
  return http.get<AnnoLabeling.ResPageNumInfo>(PORT1 + `/article/anno/pageNumInfo`, params);
};

// 数据标注-详情
export const getAnnoLabelDetail = (params: { id: number }) => {
  return http.get<DataAnno.Detail>(PORT1 + `/article/anno/detail`, params);
};

// 获取详情标注信息-含预标注
export const getDetailPreLabel = (params: { id: number }) => {
  return http.get<DataAnno.ResDetailLabel>(PORT1 + `/article/annotation/tag/detailPre`, params);
};

// 添加标注条文属性
export const addArticleAttr = (params: { articleId: number; attributeIds: number[] }) => {
  return http.post(PORT1 + `/articleAttribute/annoAdd`, params);
};

// 删除标注条文属性
export const delArticleAttr = (params: { id: number }) => {
  return http.delete(PORT1 + `/articleAttribute/annoDel/${params.id}`, params);
};

// 保存标注
export const annoSave = (params: DataAnno.ReqAnnoSaveParams) => {
  return http.post(PORT1 + `/articleTag/annoSave`, params);
};

// 提交标注
export const annoSubmit = (params: { ids: number[] }) => {
  return http.post(PORT1 + `/article/anno/submit`, params);
};

// 清空所有标注
export const clearAllAnno = (params: { id: number }) => {
  return http.post(PORT1 + `/article/anno/clear`, params);
};

// 删除标注
export const delAnno = (params: { id: number }) => {
  return http.delete(PORT1 + `/articleTag/annoDel/${params.id}`, params);
};

// 删除标注的命名标签
export const delAnnoTag = (params: { id: number; tagId: number }) => {
  return http.post(PORT1 + `/articleTag/annoDelTag`, params);
};

// 保存同义词
export const saveSynonymWord = (params: { id: number; synonymWordId: number }) => {
  return http.post(PORT1 + `/articleTag/saveSynonymWord`, params);
};

// 删除同义词
export const deSynonymWord = (params: { id: number }) => {
  return http.delete(PORT1 + `/articleTag/annoDelSynonymWord/${params.id}`, params);
};

// 保存上位词
export const saveParentStandard = (params: { id: number; parentStandardWordId: number }) => {
  return http.post(PORT1 + `/articleTag/saveParentStandard`, params);
};

// 删除上位词
export const delParentStandardWord = (params: { id: number }) => {
  return http.delete(PORT1 + `/articleTag/annoDelParentStandardWord/${params.id}`, params);
};
