import type { couponListItem } from '@/types/coupon'
import type { PageParams, PageResult } from '@/types/global'
import { request } from '@/utils/request'

// 领券中心
export const getCouponListApi = (data: PageParams) => {
  return request<PageResult<couponListItem[]>>({
    url: 'shop/coupon/center',
    method: 'GET',
    data,
  })
}

// 领券操作
export const receiveCouponApi = (id: number) => {
  return request<{ id: number }>({
    url: 'shop/coupon/receive',
    method: 'POST',
    data: {
      id,
    },
  })
}

// 我的优惠券
export const getMyCouponListApi = (
  data: PageParams & {
    status: string
  },
) => {
  return request<PageResult<couponListItem[]>>({
    url: 'shop/userCoupon/list',
    method: 'GET',
    data,
  })
}
