// (C) 2007-2026 GoodData Corporation
import { defineMessage } from "react-intl";
const WORKSPACE_SETTINGS_MENU_ITEM_ID = defineMessage({ id: "gs.header.workspaceSettings" }).id;
/**
 * @internal
 */
export const LOGOUT_MENU_ITEM_ID = defineMessage({ id: "gs.header.logout" }).id;
/**
 * @internal
 */
export function generateHeaderAccountMenuItems(workspacePermissions, workspaceId, featureFlags) {
    const { canManageProject } = workspacePermissions;
    const accountMenuItems = [];
    // When the shell (host) application is enabled, workspace settings are served by the
    // org-scoped home-ui module mounted under "/organization/settings"; its router maps
    // ".../workspaces/:workspaceId/settings" onto the configuration page. In legacy standalone
    // mode the same path is served directly from the root. This mirrors the logoHref convention
    // used by the app runtimes (enableShellApplication ? "/organization/settings" : "/").
    const workspaceSettingsBasePath = featureFlags?.enableShellApplication ? "/organization/settings" : "";
    const workspaceSettingsItem = {
        key: WORKSPACE_SETTINGS_MENU_ITEM_ID,
        className: "s-workspace-settings",
        href: `${workspaceSettingsBasePath}/workspaces/${workspaceId}/settings`,
    };
    const logoutItem = {
        key: LOGOUT_MENU_ITEM_ID,
        className: "s-logout",
    };
    if (canManageProject && featureFlags?.enableWorkspaceSettingsAppHeaderMenuItem) {
        accountMenuItems.push(workspaceSettingsItem);
    }
    accountMenuItems.push(logoutItem);
    return accountMenuItems;
}
