import request from '@/utils/request'
import type { ApiResult } from '@/api'
import type { ShopSigninConfig, ShopSigninConfigParam } from './model'

/**
 * 分页查询签到积分配置表
 */
export async function pageShopSigninConfig(params: ShopSigninConfigParam) {
  const res = await request.get<ApiResult<ShopSigninConfig[]>>(
    '/shop/shop-signin-config/page',
    params
  )
  if (res.code === 0) {
    return res.data
  }
  return Promise.reject(new Error(res.message))
}

/**
 * 查询签到积分配置表列表
 */
export async function listShopSigninConfig(params?: ShopSigninConfigParam) {
  const res = await request.get<ApiResult<ShopSigninConfig[]>>(
    '/shop/shop-signin-config',
    params
  )
  if (res.code === 0 && res.data) {
    return res.data
  }
  return Promise.reject(new Error(res.message))
}
