// ===========================
// PUBLIC ENVIRONMENT VARIABLES
// These are exposed to the client (browser)
// ===========================

export const CDN_URL = "https://staging.fakeapi.dev/storage";
export const AWS_CDN_URL = process.env.NEXT_PUBLIC_CDN_URL || "https://d2blq4bj1mzc5m.cloudfront.net";
export const OG_BANNER = "https://mymorni.com/images/morni-og-banner.jpg";
export const APPLE_ICON = "https://mymorni.com/images/morni-og-logo.jpg";
export const TEST_SITE_URL = "https://morni.vercel.app";
export const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL || "https://mymorni.com";

// ===========================
// PRIVATE ENVIRONMENT VARIABLES
// These should ONLY be used on the server-side
// NEVER import this in client components!
// ===========================

// /**
//  * @deprecated Do not use API_BASE_URL in client components
//  * Use Next.js API routes (/api/*) instead for secure server-side API calls
//  * This constant should only be used in:
//  * - Server Components
//  * - API Routes (app/api/*)
//  * - Server Actions
//  * - utils/serverApiClient.ts
//  */
// export const API_BASE_URL ="https://admin.mymorni.com/api/v1";

// ===========================
// HELPER FUNCTIONS
// ===========================

/**
 * Check if code is running on server-side
 */
export const isServer = typeof window === 'undefined';

/**
 * Get full URL for a path
 */
export function getFullUrl(path: string): string {
  return `${SITE_URL}${path.startsWith('/') ? path : `/${path}`}`;
}

/**
 * Get CDN URL for an image
 */
export function getCdnUrl(imagePath: string): string {
  if (!imagePath) return '';
  if (imagePath.startsWith('http')) return imagePath;
  return `${AWS_CDN_URL}${imagePath.startsWith('/') ? imagePath : `/${imagePath}`}`;
}

