/**
 * Feature Flags Configuration
 *
 * Controls gradual rollout of new features.
 * Initially uses environment variables, can be replaced with a feature flag service.
 */

export const FEATURE_FLAGS = {
  /**
   * Enable public services browsing (browse without login)
   */
  PUBLIC_SERVICES: process.env["NEXT_PUBLIC_FEATURE_PUBLIC_SERVICES"] !== "false",

  /**
   * Enable unified checkout (authenticated checkout flow)
   */
  UNIFIED_CHECKOUT: process.env["NEXT_PUBLIC_FEATURE_UNIFIED_CHECKOUT"] !== "false",

  /**
   * Enable public support (FAQ and contact without login)
   */
  PUBLIC_SUPPORT: process.env["NEXT_PUBLIC_FEATURE_PUBLIC_SUPPORT"] !== "false",
} as const;

/**
 * Hook to check if a feature is enabled
 */
export function useFeatureFlag(flag: keyof typeof FEATURE_FLAGS): boolean {
  return FEATURE_FLAGS[flag];
}

/**
 * Check if a feature is enabled (for use outside React components)
 */
export function isFeatureEnabled(flag: keyof typeof FEATURE_FLAGS): boolean {
  return FEATURE_FLAGS[flag];
}
