export function getApiUrl() {
    if (typeof window === 'undefined') {
        // Server-side
        return process.env.INTERNAL_API_URL || 'http://localhost:8000'
    }
    // Client-side
    const hostname = window.location.hostname
    if (hostname === 'fediversion.xyz' || hostname === 'fediversion.runfoo.run' ||
        hostname === 'elmeg.xyz' || hostname === 'elmeg.runfoo.run') {
        return '/api'
    }
    return process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'
}

// Get API URL with vertical scope
export function getVerticalApiUrl(verticalSlug: string) {
    const base = getApiUrl()
    return `${base}/v/${verticalSlug}`
}
