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