import { get, post, put, del } from '@/utils/request';

export interface CouponQueryParams { page?: number; pageSize?: number; name?: string; type?: number; status?: number; }
export interface CouponListResponse { list: any[]; total: number; pageSize: number; currentPage: number; }

export function getCouponList(params: CouponQueryParams): Promise<CouponListResponse> { return get('/marketing/coupon/list', params); }
export function getCouponById(id: number): Promise<any> { return get('/marketing/coupon/' + id); }
export function createCoupon(data: any): Promise<any> { return post('/marketing/coupon', data); }
export function updateCouponStatus(id: number, status: number): Promise<any> { return put('/marketing/coupon/' + id + '/status?status=' + status); }
export function deleteCoupon(id: number): Promise<any> { return del('/marketing/coupon/' + id); }
export function distributeCoupon(data: { templateId: number; targetType: number; userIds?: number[] }): Promise<any> { return post('/marketing/coupon/distribute', data); }
export function getCouponStatistics(id: number): Promise<any> { return get('/marketing/coupon/' + id + '/statistics'); }
export function getAvailableCoupons(): Promise<any[]> { return get('/marketing/coupon/available'); }
