import request from '@/config/axios'

// 预约规则 VO
export interface ShopDueRuleVO {
  id: number // ID
  shopId: number // 店铺id用'
  shopName: string // 店铺名称
  labelId: number // 标签ID
  interval: number // 间隔时间单位小时
  startTime: localtime // 开始时间
  endTime: localtime // 结束时间
}

// 预约规则 API
export const ShopDueRuleApi = {
  // 查询预约规则分页
  getShopDueRulePage: async (params: any) => {
    return await request.get({ url: `/store/shop-due-rule/page`, params })
  },

  // 查询预约规则详情
  getShopDueRule: async (id: number) => {
    return await request.get({ url: `/store/shop-due-rule/get?id=` + id })
  },

  // 新增预约规则
  createShopDueRule: async (data: ShopDueRuleVO) => {
    return await request.post({ url: `/store/shop-due-rule/create`, data })
  },

  // 修改预约规则
  updateShopDueRule: async (data: ShopDueRuleVO) => {
    return await request.put({ url: `/store/shop-due-rule/update`, data })
  },

  // 删除预约规则
  deleteShopDueRule: async (id: number) => {
    return await request.delete({ url: `/store/shop-due-rule/delete?id=` + id })
  },

  // 导出预约规则 Excel
  exportShopDueRule: async (params) => {
    return await request.download({ url: `/store/shop-due-rule/export-excel`, params })
  }
}