export interface DateRange {
  from?: string; // ISO 8601
  to?: string; // ISO 8601
}

export interface DiscountUsageFilters {
  date_range?: DateRange;
  discount_code?: string;
  discount_id?: number;
  user_id?: number;
  group_by_code?: boolean;
  limit: number;
  offset: number;
}

export interface DiscountUsage {
  discount_id: number;
  discount_code: string;
  discount_name: string;
  usage_count: number;
  total_amount: number; // ریال
  unique_users: number;
  first_used_at: string; // ISO 8601
  last_used_at: string; // ISO 8601
}

export interface DiscountUsageSummary {
  total_usages: number;
  total_discount_given: number; // ریال
  unique_users: number;
  unique_codes: number;
  most_used_code: string;
  most_used_code_count: number;
}

export interface DiscountUsageResponse {
  usages: DiscountUsage[] | null;
  summary: DiscountUsageSummary;
  total: number;
  has_more: boolean;
  limit: number;
  offset: number;
}

export interface CustomerDiscountUsageFilters {
  user_id: number; // Required
  date_range?: DateRange;
  discount_code?: string;
  discount_id?: number;
  limit: number;
  offset: number;
}

export interface CustomerDiscountUsage {
  discount_usage_id: number;
  user_id: number;
  customer_name: string;
  discount_id: number;
  discount_code: string;
  discount_name: string;
  order_id: number;
  order_number: string;
  amount: number; // ریال
  used_at: string; // ISO 8601
}

export interface CustomerDiscountUsageSummary {
  total_usages: number;
  total_discount_amount: number; // ریال
  unique_codes: number;
  average_discount_per_order: number; // ریال
}

export interface CustomerDiscountUsageResponse {
  usages: CustomerDiscountUsage[] | null;
  summary: CustomerDiscountUsageSummary;
  total: number;
  has_more: boolean;
  limit: number;
  offset: number;
}

