"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.processRelations = processRelations;
const postRelation_1 = require("../../../discussions/api/enums/postRelation");
const RELATIONS_MAP = {
    channel: postRelation_1.PostRelation.CHANNEL,
    channelAcl: postRelation_1.PostRelation.CHANNEL_ACL,
    parent: postRelation_1.PostRelation.PARENT,
    reactions: postRelation_1.PostRelation.REACTIONS,
    replies: postRelation_1.PostRelation.REPLIES,
    replyCount: postRelation_1.PostRelation.REPLY_COUNT,
};
/**
 * Convert an array of `include` into an array of PostRelation enum values.
 * @param relations array of include (e.g. ["channel", "replies"]).
 * @returns PostRelation[] with order of first appearance preserved and duplicates removed.
 */
function processRelations(relations = []) {
    const results = [];
    for (const rel of relations) {
        const mapped = RELATIONS_MAP[rel];
        if (mapped && !results.includes(mapped)) {
            results.push(mapped);
        }
    }
    return results;
}
//# sourceMappingURL=processRelations.js.map