import type { AccountCount, CouponList, CouponSituation } from '@/api/types/coupon'
import { API_DOMAINS, http } from '@/http/alova'

/**
 *
 * @returns 获取首页优惠券数据
 */
export function getCouponList() {
    return http.Get<CouponList>('/couponCenter/APP/couponTemplate/queryByType', {
        meta: {
            ignoreAuth: true,
        },
    })
}

/**
 *
 * @returns 获取首页收益总数
 */
export function getAccountCount() {
    return http.Get<AccountCount>('/couponCenter/APP/couponIssuerAccount/queryByUserId')
}

/**
 *
 * @returns 获取首页优惠券领取情况
 */
export function getCouponSituation() {
    return http.Get<CouponSituation>('/couponCenter/APP/couponUserAsset/queryBySendUserId')
}

/**
 * 根据优惠券类型获取优惠券数据
 * @param params
 * @returns
 */
export function getCouponByType(params) {
    return http.Get('/couponCenter/APP/couponTemplate/getTemplatesPageByType', {
        params,
    })
}

export function getHomeCouponRedemptionList(params) {
    return http.Post('/couponCenter/APP/couponUserAsset/detail', {
        ...params,
    })
}
