// LNBits API Configuration
export const LNBITS_CONFIG = {
  // Base URL for the LNBits API
  // This should point to your LNBits instance
  API_BASE_URL: `${import.meta.env.VITE_LNBITS_BASE_URL || ''}/api/v1`,

  // Whether to enable debug logging
  DEBUG: import.meta.env.VITE_LNBITS_DEBUG === 'true',

  // Timeout for API requests (in milliseconds)
  REQUEST_TIMEOUT: 10000,

  // Auth token storage key
  AUTH_TOKEN_KEY: 'lnbits_access_token',

  // User storage key
  USER_STORAGE_KEY: 'lnbits_user_data'
}

// Debug logging
console.log('🔧 LNBits Config loaded:', {
  VITE_LNBITS_BASE_URL: import.meta.env.VITE_LNBITS_BASE_URL,
  API_BASE_URL: LNBITS_CONFIG.API_BASE_URL,
  DEBUG: LNBITS_CONFIG.DEBUG
})

// Helper function to get the full API URL
export function getApiUrl(endpoint: string): string {
  return `${LNBITS_CONFIG.API_BASE_URL}${endpoint}`
}

// Helper function to get auth token from storage
export function getAuthToken(): string | null {
  return localStorage.getItem(LNBITS_CONFIG.AUTH_TOKEN_KEY)
}

// Helper function to set auth token in storage
export function setAuthToken(token: string): void {
  localStorage.setItem(LNBITS_CONFIG.AUTH_TOKEN_KEY, token)
}

// Helper function to remove auth token from storage
export function removeAuthToken(): void {
  localStorage.removeItem(LNBITS_CONFIG.AUTH_TOKEN_KEY)
} 
