import { get, post } from '../utils/http.js'

export const getAdminCenterList = async (params) => {
  try {
    const response = await get(
      `/sys/manager/props?propsType=${params.propsType}&currencyType=${params.currencyType}`
    )
    return response
  } catch (error) {
    console.error('Failed to fetch admin center list:', error)
    console.error('error:' + error.response.errorMsg)
    throw error
  }
}

export const giveProps = async (data) => {
  try {
    const response = await post('/sys/manager/send', data)
    return response
  } catch (error) {
    console.error('Failed to fetch give props:', error)
    console.error('error:' + error.response.errorMsg)
    throw error
  }
}

// 是否有指定道具类型的权限
export const hasSendGiftsPermission = async (propsType) => {
  try {
    const response = await get(`/app/h5/own-permission?propsType=${propsType}`)
    return response
  } catch (error) {
    console.error('Failed to fetch has send gifts permission:', error)
    console.error('error:' + error.response.errorMsg)
    throw error
  }
}
