import Constants from 'expo-constants';

export type AppEnv = 'development' | 'staging' | 'production';

function normalizeEnv(value: unknown): AppEnv {
  const env = String(value || '').toLowerCase();
  if (env === 'staging') return 'staging';
  if (env === 'production') return 'production';
  return 'development';
}

export const appEnv: AppEnv = normalizeEnv(Constants.expoConfig?.extra?.APP_ENV);

export const backendBaseUrl: string =
  (Constants.expoConfig?.extra?.BACKEND_BASE_URL as string | undefined) ||
  'http://localhost:3005';

