import { getRelativeWorkspaceUrl } from "../../core/getRelativeWorkspaceUrl";
import { getItemThumbnailUrl } from "../../resources/get-item-thumbnail-url";
import { getHubRelativeUrl } from "../../content/_internal/internalContentUtils";
import { getItemIdentifier } from "../../items/getItemIdentifier";
import { getItemHomeUrl } from "../../urls/get-item-home-url";
/**
 * Compute the links that get appended to a Hub Initiative
 * search result and entity
 *
 * @param item
 * @param requestOptions
 */
export function computeItemLinks(item, requestOptions) {
    let token;
    if (requestOptions.authentication) {
        const session = requestOptions.authentication;
        token = session.token;
    }
    return {
        self: getItemHomeUrl(item.id, requestOptions),
        siteRelative: getHubRelativeUrl(item.type, 
        // use slug if available, otherwise id
        getItemIdentifier(item), item.typeKeywords),
        siteRelativeEntityType: getHubRelativeUrl(item.type),
        // no SEO for workspace, so we always use id instead of slug
        workspaceRelative: getRelativeWorkspaceUrl(item.type, item.id),
        thumbnail: getItemThumbnailUrl(item, requestOptions, token),
    };
}
//# sourceMappingURL=computeItemLinks.js.map