import type { DiscountType } from "../enums.js"

export interface PromoCodeDto {
    id: string
    shopId: string
    code: string
    label: string | null
    discountType: DiscountType
    /** En centimes pour FIXED_AMOUNT, en centièmes (ex: 1000 = 10%) pour PERCENTAGE, ignoré pour FREE_PRODUCT */
    discountValue: number
    targetProductId: string | null
    targetProductName?: string | null
    targetCategoryId: string | null
    targetCategoryName?: string | null
    maxUses: number | null
    maxUsesPerOrder: number
    currentUses: number
    startsAt: string | null
    expiresAt: string | null
    active: boolean
    createdAt: string
}

export interface PromoCodeUsageDto {
    id: string
    promoCodeId: string
    promoCode: string
    promoLabel: string | null
    discountType: DiscountType
    discountApplied: number
    createdAt: string
}

export interface ApplyPromoCodeResultDto {
    success: boolean
    message: string
    usage?: PromoCodeUsageDto
    /** Nouveau total de la commande après application */
    newTotal: number
    /** Total des remises sur la commande */
    discountTotal: number
}

export interface RemovePromoCodeResultDto {
    success: boolean
    message: string
    newTotal: number
    discountTotal: number
}

