import { Coupon, CouponStatus } from '../entities/coupon.entity'; export const COUPON_REPOSITORY = Symbol('ICouponRepository'); export interface CouponListFilters { category?: string; status?: string; search?: string; issuerId?: string; page: number; limit: number; } export interface CouponAggregateResult { totalCoupons: number; totalSupply: number; totalSold: number; totalRemaining: number; } export interface CouponStatusCount { status: string; count: number; } export interface CouponsByIssuerRow { issuerId: string; couponCount: number; totalSupply: number; totalSold: number; totalFaceValue: number; } export interface CouponsByCategoryRow { category: string; couponCount: number; totalSupply: number; totalSold: number; avgPrice: number; } export interface CouponSoldAggregateRow { issuerId: string; totalSold: number; } export interface DiscountDistributionRow { range: string; count: number; avgDiscount: number; } export interface RedemptionRateRow { month: string; totalIssued: number; totalSold: number; } export interface OwnerSummary { count: number; totalFaceValue: number; totalSaved: number; } export interface ICouponRepository { findById(id: string): Promise; create(data: Partial): Promise; save(coupon: Coupon): Promise; findAndCount(filters: CouponListFilters): Promise<[Coupon[], number]>; findAndCountWithIssuerJoin(filters: CouponListFilters): Promise<[Coupon[], number]>; findByOwnerWithIssuerJoin(userId: string, filters: CouponListFilters): Promise<[Coupon[], number]>; getOwnerSummary(userId: string): Promise; updateStatus(id: string, status: string): Promise; purchaseWithLock(couponId: string, quantity: number): Promise; count(where?: Partial>): Promise; // Analytics aggregates getAggregateStats(): Promise; getStatusCounts(): Promise; getCouponsByIssuer(): Promise; getCouponsByCategory(): Promise; getTotalSold(): Promise; getTotalSoldByStatuses(statuses: CouponStatus[]): Promise; getRedemptionRateTrend(): Promise; getDiscountDistribution(): Promise; // Merchant analytics getCouponSupplyAggregate(): Promise<{ totalCouponsIssued: number; totalCouponsSold: number }>; getSoldPerIssuer(issuerIds: string[]): Promise; getRecentlySoldCoupons(limit: number): Promise; }