

export const APP_CONFIG = {
  APP_NAME: "Hệ thống VPEG AM & O&M",
  APP_VERSION: "1.2.0",
  ENV: (import.meta as any).env?.MODE || "development",
  // Use relative path for API - Apache will proxy /api/ to backend
  // Frontend calls /api/... and Apache proxies to backend
  // Always use relative path - if VITE_API_URL is absolute, it will be normalized in apiClient
  API_URL: (() => {
    const envUrl = (import.meta as any).env?.VITE_API_URL;
    // If VITE_API_URL is absolute, extract path only
    if (envUrl && (envUrl.startsWith('http://') || envUrl.startsWith('https://'))) {
      try {
        return new URL(envUrl).pathname;
      } catch {
        return '/api';
      }
    }
    return envUrl || '/api';
  })(),
  DATA_MODE: (import.meta as any).env?.VITE_DATA_MODE || "demo",
  DATE_FORMAT: "vi-VN",
  CURRENCY: "VND",
  CONTACT_EMAIL: "tuan.vo@vuphong.com",
  // Domain configuration
  DOMAIN: "aom.vuphong.com"
};

export const DB_CONFIG = {
  MONGODB_URI: (import.meta as any).env?.VITE_MONGODB_URI || (import.meta as any).env?.MONGODB_URI || "",
  DATA_MODE: (import.meta as any).env?.VITE_DATA_MODE || (import.meta as any).env?.DATA_MODE || "demo",
  mongodb: {
    uri: (import.meta as any).env?.VITE_MONGODB_URI || (import.meta as any).env?.MONGODB_URI || "",
    options: {
      // MongoDB connection options
    }
  },
  demo: {
    dataPath: './data/demo',
    autoSave: false
  }
};

export const THEME_CONFIG = {
  colors: {
    primary: "#2563eb", // blue-600
    success: "#16a34a", // green-600
    warning: "#ca8a04", // yellow-600
    danger: "#dc2626", // red-600
  }
};