/**
 * Stripe Service Module
 *
 * Public API for all Stripe-related functionality.
 * This module consolidates all Stripe operations into a cohesive interface.
 *
 * Module Structure:
 * - client.ts: Stripe client initialization and org-specific clients
 * - checkout.ts: Checkout session creation
 * - subscriptions.ts: Subscription management (upgrade/downgrade/cancel)
 * - pricing.ts: Price lookups and calculations
 * - customers.ts: Customer management
 * - refunds.ts: Refund operations
 * - seats.ts: Additional seat purchases
 */

// =============================================================================
// Client Exports
// =============================================================================

export {
  stripe,
  stripePublicKey,
  getStripeClient,
  getStripeClientForOrganization,
  hasOrganizationStripeKeys,
  clearOrgStripeClientCache,
  type OrgStripeClientResult,
} from './client';

// =============================================================================
// Checkout Exports
// =============================================================================

export {
  createCheckoutSession,
  createSubscriptionSession,
  getCheckoutSession,
  createCheckoutSessionForOrganization,
  createDepositCheckoutWithConnect,
  createSubscriptionWithSetup,
} from './checkout';

// =============================================================================
// Subscription Exports
// =============================================================================

export {
  cancelSubscription,
  updateSubscription,
  previewPlanChange,
  previewSubscriptionUpgrade,
  upgradeSubscription,
  downgradeSubscription,
  changeBillingPeriod,
} from './subscriptions';

// =============================================================================
// Pricing Exports
// =============================================================================

export {
  getPriceForTier,
  findPriceForTier,
  calculateSubscriptionCost,
  getSetupFee,
  calculateProration,
} from './pricing';

// =============================================================================
// Customer Exports
// =============================================================================

export {
  createCustomer,
  getCustomer,
  getOrCreateCustomer,
  createPaymentIntent,
} from './customers';

// =============================================================================
// Refund Exports
// =============================================================================

export {
  createRefund,
  getRefund,
  listRefunds,
  cancelRefund,
  getRefundablePayments,
  getCustomerRefunds,
  type RefundReason,
} from './refunds';

// =============================================================================
// Seat Exports
// =============================================================================

export {
  getSeatSubscriptionItem,
  purchaseAdditionalSeats,
  updateSeatQuantity,
  createSeatCheckoutSession,
} from './seats';

// =============================================================================
// Connect Exports
// =============================================================================

export {
  createConnectedAccount,
  createAccountLink,
  getAccountStatus,
  calculatePlatformFee,
  getDepositPlatformFee,
  createDashboardLink,
} from './connect';

// =============================================================================
// Correlation ID Exports (for request tracing)
// =============================================================================

export {
  addCorrelationToMetadata,
  getCorrelationFromStripeObject,
  getRequestIdFromStripeObject,
  getEnvironmentFromStripeObject,
  initializeCorrelationFromWebhook,
  generateIdempotencyKey,
  logStripeApiCall,
  logStripeApiResponse,
  logStripeApiError,
  STRIPE_CORRELATION_ID_KEY,
  STRIPE_REQUEST_ID_KEY,
  STRIPE_ENVIRONMENT_KEY,
} from './correlation';
