// ============================================================================
// Subscription request / response types
// Generated from:
//   honeyDueAPI-go/internal/services/subscription_service.go
//   honeyDueAPI-go/internal/models/subscription.go (SubscriptionTier enum)
// ============================================================================

// ---------------------------------------------------------------------------
// Enums
// ---------------------------------------------------------------------------

/** Matches models.SubscriptionTier string enum in Go. */
export type SubscriptionTier = "free" | "pro";

// ---------------------------------------------------------------------------
// Requests
// ---------------------------------------------------------------------------

export interface ProcessPurchaseRequest {
  receipt_data?: string;
  transaction_id?: string;
  purchase_token?: string;
  product_id?: string;
  platform: "ios" | "android";
}

// ---------------------------------------------------------------------------
// Responses
// ---------------------------------------------------------------------------

export interface SubscriptionResponse {
  tier: string;
  subscribed_at: string | null;
  expires_at: string | null;
  auto_renew: boolean;
  cancelled_at: string | null;
  platform: string;
  is_active: boolean;
  is_pro: boolean;
}

export interface TierLimitsResponse {
  tier: string;
  properties_limit: number | null;
  tasks_limit: number | null;
  contractors_limit: number | null;
  documents_limit: number | null;
}

export interface UsageResponse {
  properties_count: number;
  tasks_count: number;
  contractors_count: number;
  documents_count: number;
}

export interface TierLimitsClientResponse {
  properties: number | null;
  tasks: number | null;
  contractors: number | null;
  documents: number | null;
}

export interface SubscriptionStatusResponse {
  tier: string;
  is_active: boolean;
  subscribed_at: string | null;
  expires_at: string | null;
  auto_renew: boolean;
  usage: UsageResponse | null;
  limits: Record<string, TierLimitsClientResponse>;
  limitations_enabled: boolean;
  trial_start?: string | null;
  trial_end?: string | null;
  trial_active?: boolean;
  subscription_source?: string;
}

export interface UpgradeTriggerResponse {
  trigger_key: string;
  title: string;
  message: string;
  promo_html: string;
  button_text: string;
}

export interface UpgradeTriggerDataResponse {
  title: string;
  message: string;
  promo_html: string | null;
  button_text: string;
}

export interface FeatureBenefitResponse {
  feature_name: string;
  free_tier_text: string;
  pro_tier_text: string;
  display_order: number;
}

export interface PromotionResponse {
  promotion_id: string;
  title: string;
  message: string;
  link: string | null;
  start_date: string;
  end_date: string;
}

// ---------------------------------------------------------------------------
// Stripe Checkout / Portal
// ---------------------------------------------------------------------------

export interface CheckoutSessionRequest {
  price_id: string;
  success_url: string;
  cancel_url: string;
}

export interface CheckoutSessionResponse {
  checkout_url: string;
}

export interface PortalSessionRequest {
  return_url: string;
}

export interface PortalSessionResponse {
  portal_url: string;
}

// ---------------------------------------------------------------------------
// Purchase response wrappers (inline maps from handler)
// ---------------------------------------------------------------------------

export interface PurchaseResponse {
  message: string;
  subscription: SubscriptionResponse;
}
