"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getHubDownloadApiFormats = getHubDownloadApiFormats;
const getCreateReplicaFormats_1 = require("./_internal/format-fetchers/getCreateReplicaFormats");
const getPagingJobFormats_1 = require("./_internal/format-fetchers/getPagingJobFormats");
const canUseCreateReplica_1 = require("./canUseCreateReplica");
const canUseHubDownloadSystem_1 = require("./canUseHubDownloadSystem");
const getFgdbJobFormats_1 = require("./_internal/format-fetchers/getFgdbJobFormats");
const get_prop_1 = require("../objects/get-prop");
/**
 * Returns all the formats that are available for download via the Hub Download API for a given entity.
 * Formats will vary from entity to entity depending on actual operation that the Hub Download API will
 * perform under the hood (e.g., hitting /createReplica or paging through the service's features).
 *
 * @param entity Service entity to return download formats for
 * @returns available download formats for the entity
 */
function getHubDownloadApiFormats(entity) {
    let result = [];
    if ((0, canUseCreateReplica_1.canUseCreateReplica)(entity)) {
        result = (0, getCreateReplicaFormats_1.getCreateReplicaFormats)(entity);
    }
    else if ((0, canUseHubDownloadSystem_1.canUseHubDownloadSystem)(entity)) {
        const isExtractEnabled = !!(0, get_prop_1.getProp)(entity, "extendedProps.serverExtractCapability");
        result = isExtractEnabled ? (0, getFgdbJobFormats_1.getFgdbJobFormats)() : (0, getPagingJobFormats_1.getPagingJobFormats)();
    }
    return result;
}
//# sourceMappingURL=getHubDownloadApiFormats.js.map