import httpRequest from "@/utils/request";

// 手册相关
const manualUrl = '/manuals-manage';
export const getManualListApi = (classify?: number) => {
  if (classify) {
    return httpRequest.get(`${manualUrl}/bycla/${classify}`);
  } else {
    return httpRequest.get(manualUrl);
  }
};
export const getManualInfoApi = (id: string) => httpRequest.get(`${manualUrl}/${id}`);
export const addManualApi = (data: any) => httpRequest.post(manualUrl, data);
export const editManualApi = (id: string, data: any) => httpRequest.patch(`${manualUrl}/${id}`, data);
export const deleteManualApi = (data: any) => httpRequest.post(`${manualUrl}/portion`, data);

// 手册分类相关
const manualClassifyUrl = '/manuals-manage/classify';
export const getManualClassifyListApi = (params?: any) => httpRequest.get(manualClassifyUrl, params);
export const getManualClassifyInfoApi = (params: any) => httpRequest.get(manualClassifyUrl, params);
export const addManualClassifyApi = (data: any) => httpRequest.post(manualClassifyUrl, data);
export const editManualClassifyApi = (data: any) => httpRequest.post(`${manualClassifyUrl}/editor`, data);
export const deleteManualClassifyApi = (id: number) => httpRequest.delete(`${manualClassifyUrl}/${id}`);

// 手册文章
const manualArticleUrl = '/article-manage';
export const getManualArticleListApi = (id: number) => httpRequest.get(`${manualArticleUrl}/manuals/${id}`);
export const getManualArticleInfoApi = (id: number) => httpRequest.get(`${manualArticleUrl}/${id}`);
export const addManualArticleApi = (data: any) => httpRequest.post(manualArticleUrl, data);
export const editManualArticleApi = (data: any) => httpRequest.patch(manualArticleUrl, data);
export const deleteManualArticleApi = (data: any) => httpRequest.post(`${manualArticleUrl}/portion`, data);
