import request from '@/utils/request'
import Qs from 'qs'


export function listCoupon(query) {
    return request({
        url: '/dyCoupon/list',
        method: 'get',
        params: query
    })
}

export function createCoupon(data) {
    return request({
        url: '/dyCoupon/create',
        method: 'post',
        data
    })
}

export function increaseCoupon(data) {
    return request({
        url: '/dyCoupon/increase',
        method: 'get',
        params: data
    })
}

export function deleteCoupon(data) {
    return request({
        url: '/dyCoupon/delete',
        method: 'post',
        data
    })
}

export function readCoupon(id) {
    return request({
      url: '/dyCoupon/read',
      method: 'get',
      params: { id }
    })
  }
  

export function listCouponUser(query) {
    return request({
        url: '/dyCoupon/listCouponUser',
        method: 'get',
        params: query
    })
} 

export function listCouponTalent(query) {
    return request({
        url: '/dyCoupon/listCouponTalent',
        method: 'get',
        params: query
    })
} 


export function talentAllocationInfo(query) {
    return request({
        url: '/dyCoupon/talentAllocationInfo',
        method: 'get',
        params: query,
        paramsSerializer: function(params) {
            return Qs.stringify(params, { arrayFormat: 'repeat' })
        }
    })
} 


export function allocationCoupon(data) {
    return request({
        url: '/dyCoupon/allocation',
        method: 'post',
        data
    })
}

export function increaseTalentCoupon(data) {
    return request({
        url: '/dyCoupon/increaseTalent',
        method: 'get',
        params: data
    })
}

export function talentPutOff(data) {
    return request({
        url: '/dyCoupon/putOff',
        method: 'post',
        data
    })
}

export function talentPutOn(data) {
    return request({
        url: '/dyCoupon/putOn',
        method: 'post',
        data
    })
}