import http from '@/utils/http'
import { AppDispatch } from '..'
import { C1addType, C1bkType } from '@/types'

/**
 *展馆预约设置-列表
 */
export const C1_APIgetList = (): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post('museum/appointmentSlots/list')
    if (res.code === 0) {
      dispatch({ type: 'C1/getList', payload: res.data || [] })
    }
  }
}

/**
 * 展馆预约设置-删除
 */
export const C1_APIdel = (ids: string) => {
  return http.post(`museum/appointmentSlots/del/${ids}`)
}

/**
 * 展馆预约设置-新增-修改
 */
export const C1_APIsave = (data: C1addType[]) => {
  return http.post('museum/appointmentSlots/saveOrEdit', data)
}

/**
 * 根据不同Type设置不可预约日期和预约须知
 */
export const C1_APIsavebk = (data: C1bkType) => {
  return http.post('museum/appointmentConfig/saveOrEditByType', data)
}

/**
 * 根据不同Type删除不可预约日期和预约须知
 */
export const C1_APIdelbk = (data: C1bkType) => {
  return http.post('museum/appointmentConfig/delByType', data)
}

/**
 * 根据不同Type获取不可预约日期和预约须知
 */
export const C1_APIgetbk = (data: C1bkType) => {
  return http.post('museum/appointmentConfig/getInfoByType', data)
}
