import {
  AddHistoryParams,
  GetHistoryDetailResponse,
  GetHistoryListParams,
  GetHistoryListResponse,
  HistoryDictItem,
} from "@/types";
import { service } from "@dage/web-components";

export const historyApi = {
  getHistoryDictList: () => {
    return service.get<HistoryDictItem[]>("/api/cms/history/getDict");
  },
  getList(data: GetHistoryListParams) {
    return service.post<GetHistoryListResponse>(
      "/api/cms/history/pageList",
      data
    );
  },
  add: (data: AddHistoryParams) => {
    return service.post("/api/cms/history/save", data);
  },
  del: (id: number) => {
    return service.get(`/api/cms/history/remove/${id}`);
  },
  getDetail: (id: string) => {
    return service.get<GetHistoryDetailResponse>(
      `/api/cms/history/detail/${id}`
    );
  },
};
