using PromotionService.API.Application.DTOs;

namespace PromotionService.API.Application.DTOs;

/// <summary>
/// EN: Paginated response wrapper.
/// VI: Wrapper cho response phân trang.
/// </summary>
public record PaginatedResponse<T>(
    IEnumerable<T> Items,
    int TotalCount,
    int PageNumber,
    int PageSize,
    int TotalPages);

/// <summary>
/// EN: Campaign statistics for admin view.
/// VI: Thống kê chiến dịch cho admin.
/// </summary>
public record AdminCampaignStatisticsDto(
    Guid CampaignId,
    string CampaignName,
    string Status,
    int TotalVouchers,
    int IssuedVouchers,
    int AvailableVouchers,
    int ClaimedVouchers,
    int RedeemedVouchers,
    int ExpiredVouchers,
    decimal TotalFaceValue,
    decimal TotalRedeemedValue,
    decimal TotalRefundedValue,
    decimal UtilizationRate,
    int TotalRedemptions,
    DateTime? FirstClaimedAt,
    DateTime? LastRedeemedAt);

/// <summary>
/// EN: Admin campaign list item with stats.
/// VI: Item danh sách chiến dịch admin với thống kê.
/// </summary>
public record AdminCampaignListDto(
    Guid Id,
    Guid MerchantId,
    string Name,
    string BackingAssetType,
    string BackingAssetCode,
    decimal FaceValue,
    string AcquisitionType,
    string Status,
    int TotalVouchers,
    int IssuedVouchers,
    DateTime StartDate,
    DateTime EndDate,
    DateTime CreatedAt);

/// <summary>
/// EN: Admin voucher list item with details.
/// VI: Item danh sách voucher admin với chi tiết.
/// </summary>
public record AdminVoucherListDto(
    Guid Id,
    Guid CampaignId,
    string CampaignName,
    string Code,
    Guid? OwnerId,
    string? OwnerEmail,
    decimal FaceValue,
    decimal RemainingValue,
    string Status,
    DateTime? ClaimedAt,
    DateTime? ExpiresAt,
    DateTime? RedeemedAt,
    DateTime CreatedAt);

/// <summary>
/// EN: Admin redemption list item.
/// VI: Item danh sách redemption admin.
/// </summary>
public record AdminRedemptionListDto(
    Guid Id,
    Guid VoucherId,
    string VoucherCode,
    Guid CampaignId,
    string CampaignName,
    Guid UserId,
    Guid? OrderId,
    decimal AmountUsed,
    decimal AmountRefunded,
    DateTime RedeemedAt);

/// <summary>
/// EN: Redemption statistics for admin.
/// VI: Thống kê redemption cho admin.
/// </summary>
public record AdminRedemptionStatisticsDto(
    int TotalRedemptions,
    decimal TotalAmountUsed,
    decimal TotalAmountRefunded,
    decimal AverageRedemptionAmount,
    int RedemptionsToday,
    int RedemptionsThisWeek,
    int RedemptionsThisMonth);

/// <summary>
/// EN: Campaign filter for admin queries.
/// VI: Filter chiến dịch cho admin queries.
/// </summary>
public record AdminCampaignFilter(
    Guid? MerchantId = null,
    string? Status = null,
    DateTime? StartDateFrom = null,
    DateTime? StartDateTo = null,
    string? SearchTerm = null);

/// <summary>
/// EN: Voucher filter for admin queries.
/// VI: Filter voucher cho admin queries.
/// </summary>
public record AdminVoucherFilter(
    Guid? CampaignId = null,
    Guid? UserId = null,
    string? Status = null,
    string? CodeSearch = null,
    DateTime? ExpiresAfter = null,
    DateTime? ExpiresBefore = null);
