"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.computeProps = computeProps;
const computeItemProps_1 = require("../../core/_internal/computeItemProps");
const applyDiscussionMigrations_1 = require("./applyDiscussionMigrations");
const get_item_thumbnail_url_1 = require("../../resources/get-item-thumbnail-url");
/**
 * Given a model and a Discussion, set various computed properties that can't be directly mapped
 * @private
 * @param model
 * @param discussion
 * @param requestOptions
 * @returns an IHubDiscussion
 */
function computeProps(model, discussion, requestOptions) {
    let token;
    if (requestOptions.authentication) {
        const session = requestOptions.authentication;
        token = session.token;
    }
    // compute base properties on discussion
    discussion = (0, computeItemProps_1.computeItemProps)(model.item, discussion);
    // thumbnail url
    discussion.thumbnailUrl = (0, get_item_thumbnail_url_1.getItemThumbnailUrl)(model.item, requestOptions, token);
    // Apply migrations
    discussion = (0, applyDiscussionMigrations_1.applyDiscussionMigrations)(discussion);
    // cast b/c this takes a partial but returns a full object
    return discussion;
}
//# sourceMappingURL=computeProps.js.map