"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.computeProps = computeProps;
const processEntityFeatures_1 = require("../../permissions/_internal/processEntityFeatures");
const InitiativeTemplateBusinessRules_1 = require("./InitiativeTemplateBusinessRules");
const computeLinks_1 = require("./computeLinks");
const computeItemProps_1 = require("../../core/_internal/computeItemProps");
const get_item_thumbnail_url_1 = require("../../resources/get-item-thumbnail-url");
/**
 * Given a model and an initiative template, set various computed properties that can't be directly mapped
 * @private
 * @param model
 * @param initiativeTemplate
 * @param requestOptions
 * @returns
 */
function computeProps(model, initiativeTemplate, requestOptions) {
    var _a;
    let token;
    if (requestOptions.authentication) {
        const session = requestOptions.authentication;
        token = session.token;
    }
    // compute base properties on initiativeTemplate
    initiativeTemplate = (0, computeItemProps_1.computeItemProps)(model.item, initiativeTemplate);
    // thumbnail url
    initiativeTemplate.thumbnailUrl = (0, get_item_thumbnail_url_1.getItemThumbnailUrl)(model.item, requestOptions, token);
    /**
     * Features that can be disabled by the entity owner
     * We don't have explicit features for initiative templates yet,
     * but the groundwork is there
     */
    initiativeTemplate.features = (0, processEntityFeatures_1.processEntityFeatures)(((_a = model.data.settings) === null || _a === void 0 ? void 0 : _a.features) || {}, InitiativeTemplateBusinessRules_1.InitiativeTemplateDefaultFeatures);
    initiativeTemplate.links = (0, computeLinks_1.computeLinks)(model.item, requestOptions);
    // cast b/c this takes a partial but returns a full initiative template
    return initiativeTemplate;
}
//# sourceMappingURL=computeProps.js.map