import http from "@/utils/http";
import { AppDispatch } from "..";

/**
 *展馆预约设置-列表
 */

export const C1_APIgetList = (): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.get("cms/book/getList");
    if (res.code === 0) {
      dispatch({ type: "C1/getList", payload: res.data || [] });
    }
  };
};

/**
 * 展馆预约设置-详情
 */
export const C1_APIgetInfo = (id: number) => {
  return http.get(`cms/book/detail/${id}`);
};

/**
 * 展馆预约设置-删除
 */
export const C1_APIdel = (ids: string) => {
  return http.get(`cms/book/removes/${ids}`);
};

/**
 * 展馆预约设置-配置详情
 */
export const C1_APIgetConfig = (id: number) => {
  return http.get(`cms/book/getConfig/${id}`);
};

/**
 * 展馆预约设置-配置编辑
 */
export const C1_APIsetConfig = (data: { id: number; rtf: string }) => {
  return http.post("cms/book/setConfig", data);
};

/**
 * 展馆预约设置-新增、修改
 */
export const C1_APIsave = (data: any) => {
  return http.post("cms/book/save", data);
};
