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

/**
 * @name 语料库-首见条文
 */
// 获取首见条文列表
export const getFirstClauseList = (params: FirstClause.ReqFirstClauseParams) => {
  return http.get<ResPage<Clause.ClauseInfo>>(PORT1 + `/article/first/list`, params);
};

// 获取相关条文列表
export const getRelateClauseList = (params: { id: number }) => {
  return http.get<Clause.ClauseInfo[]>(PORT1 + `/article/relate/list`, params);
};

// 相关条文设置为首见条文
export const relateSetFirst = (params: { id: number }) => {
  return http.post(PORT1 + `/article/relate/setFirst`, params);
};

// 编辑
export const editClause = (params: Partial<Clause.ClauseInfo>) => {
  return http.post(PORT1 + `/article/info/update`, params);
};

// 逻辑删除
export const logicDeleteClause = (params: { articleIds: number[] }) => {
  return http.post(PORT1 + `/article/logic/del`, params);
};

// 条文详情
export const getFirstClauseDetail = (params: { id: number }) => {
  return http.get<Clause.ClauseInfo>(PORT1 + `/article/first/detail`, params);
};

// 导出
export const exportFirstClause = (params: { articleIds: string[] }) => {
  return http.download(PORT1 + `/article/first/excel/export`, params);
};
