import { darken } from '../colorHelper';

export const getHeaderNavigationVariables = ({
    navBarPadding,
    navBarBackgroundColor,
    navBarBorderColor,
    navBarLinkSpacing,
    navBarTextColor,
    navBarTextHoverColor
}) => ({
    'header-nav-bar-padding': navBarPadding && `${navBarPadding}px`,
    'header-nav-bg-color': navBarBackgroundColor,
    'header-nav-border-color': navBarBorderColor,
    'header-nav-item-spacing': navBarLinkSpacing && `${navBarLinkSpacing / 2}px`,
    'text-color': navBarTextColor,
    'text-hover-color': navBarTextHoverColor || (navBarTextColor && darken(navBarTextColor, 0.25))
});

export const generateUserLinks = (baseUrl, user, i18n) => {
    if (!baseUrl || !user || !i18n) {
        return null;
    }
    return ([
        {
            label: i18n.profile,
            url: `${baseUrl}/profile/${user.userUuid}`
        },
        {
            label: i18n.account,
            url: `${baseUrl}/account/home`
        },
        {
            label: i18n.company,
            url: `${baseUrl}/companies/${user.companyUuid}`
        },
        {
            label: i18n.settings,
            url: `${baseUrl}/settings`
        },
        {
            label: i18n.logout,
            url: `${baseUrl}/logout`
        }
    ]);
};

export const getMenu = (menuItems, menuType) => menuItems && menuItems[menuType] && menuItems[menuType].menu;
