import { AppConfig } from "./types/config";
import { loadConfigFromOpenApi } from "./utils/openapi_loader";

export async function getAppConfig(): Promise<AppConfig> {
  const baseUrl = import.meta.env.VITE_API_BASE_URL || "http://localhost:8000"
  const config = await loadConfigFromOpenApi(baseUrl);

  // You can still apply overrides here
  return {
    ...config,
    authBaseUrl: import.meta.env.VITE_AUTH_BASE_URL || "http://localhost:8001",
    baseUrl: import.meta.env.VITE_API_BASE_URL || config.baseUrl,
  };
}
