import request from '@/utils/request'

export function getCouponList(urlParams, data) {
  return request({
    url: '/api/v1/mp/admin/coupon/list',
    method: 'post',
    data,
    urlParams
  })
}

export function getCouponDetail(couponId) {
  return request({
    url: '/api/v1/mp/admin/coupon/detail',
    method: 'post',
    data: {
      couponId
    }
  })
}

export function addCoupon(data) {
  return request({
    url: `/api/v1/mp/admin/coupon/${data.couponId ? 'update' : 'create'}`,
    method: 'post',
    data
  })
}

export function delCoupon(couponId) {
  return request({
    url: '/api/v1/mp/admin/coupon/remove',
    method: 'post',
    data: { couponId }
  })
}

export function setCouponStatus(data) {
  return request({
    url: '/api/v1/mp/admin/coupon/status',
    method: 'post',
    data
  })
}
