"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetchHubEntity = fetchHubEntity;
const fetch_1 = require("../discussions/fetch");
const fetchHubContent_1 = require("../content/fetchHubContent");
const HubInitiatives_1 = require("../initiatives/HubInitiatives");
const HubPages_1 = require("../pages/HubPages");
const fetch_2 = require("../projects/fetch");
const HubSites_1 = require("../sites/HubSites");
const fetch_3 = require("../templates/fetch");
const HubGroups_1 = require("../groups/HubGroups");
const fetch_4 = require("../initiative-templates/fetch");
const fetch_5 = require("../events/fetch");
const fetch_6 = require("../org/fetch");
const fetch_7 = require("../channels/fetch");
const HubUsers_1 = require("../users/HubUsers");
/**
 * Fetch a Hub entity by identifier (id or slug)
 * @param type
 * @param identifier
 * @param context
 * @returns
 */
async function fetchHubEntity(type, identifier, context) {
    let result;
    switch (type) {
        case "project":
            result = await (0, fetch_2.fetchProject)(identifier, context.requestOptions);
            break;
        case "site":
            result = await (0, HubSites_1.fetchSite)(identifier, context.hubRequestOptions);
            break;
        case "initiative":
            result = await (0, HubInitiatives_1.fetchInitiative)(identifier, context.requestOptions);
            break;
        case "discussion":
            result = await (0, fetch_1.fetchDiscussion)(identifier, context.hubRequestOptions);
            break;
        case "channel":
            result = await (0, fetch_7.fetchHubChannel)(identifier, context);
            break;
        case "page":
            result = await (0, HubPages_1.fetchPage)(identifier, context.hubRequestOptions);
            break;
        case "content":
            result = await (0, fetchHubContent_1.fetchHubContent)(identifier, context.hubRequestOptions);
            break;
        case "template":
            result = await (0, fetch_3.fetchTemplate)(identifier, context.requestOptions);
            break;
        case "group":
            result = await (0, HubGroups_1.fetchHubGroup)(identifier, context.hubRequestOptions);
            break;
        case "event":
            result = await (0, fetch_5.fetchEvent)(identifier, context.hubRequestOptions);
            break;
        case "organization":
            result = await (0, fetch_6.fetchOrganization)(identifier, context.requestOptions);
            break;
        case "initiativeTemplate":
            result = await (0, fetch_4.fetchInitiativeTemplate)(identifier, context.requestOptions);
            break;
        case "user":
            result = await (0, HubUsers_1.fetchHubUser)(identifier, context);
    }
    return result;
}
//# sourceMappingURL=fetchHubEntity.js.map