export type SubscriptionTier = 'free' | 'pro' | 'enterprise';
export type BillingCycle = 'monthly' | 'yearly';
export type SubscriptionStatus = 'active' | 'past_due' | 'canceled' | 'unpaid';

export interface Subscription {
  id: string;
  userId: string;
  stripeCustomerId: string;
  stripeSubscriptionId?: string;
  tier: SubscriptionTier;
  billingCycle?: BillingCycle;
  status: SubscriptionStatus;
  currentPeriodStart?: string;
  currentPeriodEnd?: string;
  gracePeriodEnd?: string;
  cancelAtPeriodEnd: boolean;
  createdAt: string;
  updatedAt: string;
}

export interface SubscriptionPlan {
  tier: SubscriptionTier;
  name: string;
  monthlyPrice: number;
  yearlyPrice: number;
  features: string[];
  vehicleLimit: number | 'unlimited';
}

export interface CheckoutRequest {
  tier: SubscriptionTier;
  billingCycle: BillingCycle;
  paymentMethodId: string;
}

export interface PaymentMethodUpdateRequest {
  paymentMethodId: string;
}

export interface DowngradeRequest {
  targetTier: SubscriptionTier;
  vehicleIdsToKeep: string[];
}

export interface NeedsVehicleSelectionResponse {
  needsSelection: boolean;
  vehicleCount: number;
  maxAllowed: number;
}
