import { processEntityFeatures } from "../../permissions/_internal/processEntityFeatures";
import { InitiativeTemplateDefaultFeatures } from "./InitiativeTemplateBusinessRules";
import { computeLinks } from "./computeLinks";
import { computeItemProps } from "../../core/_internal/computeItemProps";
import { getItemThumbnailUrl } from "../../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
 */
export 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 = computeItemProps(model.item, initiativeTemplate);
    // thumbnail url
    initiativeTemplate.thumbnailUrl = 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 = processEntityFeatures(((_a = model.data.settings) === null || _a === void 0 ? void 0 : _a.features) || {}, InitiativeTemplateDefaultFeatures);
    initiativeTemplate.links = computeLinks(model.item, requestOptions);
    // cast b/c this takes a partial but returns a full initiative template
    return initiativeTemplate;
}
//# sourceMappingURL=computeProps.js.map