// ========================
// Enums — mirrors backend PlanType / BillingIntervalType
// ========================

export enum PlanType {
  FREE = "free",
  PLUS = "plus",
  PREMIUM = "premium",
}

export enum BillingInterval {
  MONTHLY = "monthly",
  YEARLY = "yearly",
}

// ========================
// Response DTOs
// ========================

export interface UsageLimitDto {
  analysisCount: number;
  couponCount: number;
  maxAnalyses: number;
  maxCoupons: number;
}

export interface SubscriptionDto {
  id: string;
  plan: PlanType;
  billingInterval: BillingInterval | null;
  currentPeriodStart: string | null;
  currentPeriodEnd: string | null;
  cancelledAt: string | null;
  cancelEffectiveDate: string | null;
  paddlePriceId: string | null;
  createdAt: string;
  updatedAt: string;
}

export interface PlanLimits {
  maxAnalyses: number;
  maxCoupons: number;
}

export interface PlanInfo {
  id: PlanType;
  name: string;
  description: string;
  monthlyPrice: number;
  yearlyPrice: number;
  currency: string;
  features: string[];
  limits: PlanLimits;
  highlighted: boolean;
}

// ========================
// Request DTOs
// ========================

export interface CreateCheckoutRequest {
  plan: PlanType;
  billingInterval: BillingInterval;
}

export interface CancelSubscriptionRequest {
  reason?: string;
}

// ========================
// Checkout Config Response
// ========================

export interface CheckoutConfigDto {
  priceId: string;
  clientToken: string;
  environment: string;
  userId: string;
}
