"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDownloadFlow = getDownloadFlow;
const get_prop_1 = require("../../objects/get-prop");
const canUseCreateReplica_1 = require("../canUseCreateReplica");
const canUseHubDownloadSystem_1 = require("../canUseHubDownloadSystem");
const canUseExportImageFlow_1 = require("./canUseExportImageFlow");
/**
 * @private
 * Determines the download flow that will be used for the current entity.
 * If the entity cannot be downloaded, returns null.
 *
 * @param entity the entity to get the download flow for
 * @param isEnterprise whether the the download will be executed in an enterprise environment
 * @returns the download flow that will be used for the current entity
 */
function getDownloadFlow(entity, isEnterprise) {
    let downloadFlow = null;
    if ((0, canUseCreateReplica_1.canUseCreateReplica)(entity)) {
        downloadFlow = "createReplica";
    }
    else if ((0, canUseHubDownloadSystem_1.canUseHubDownloadSystem)(entity) && !isEnterprise) {
        const isExtractEnabled = !!(0, get_prop_1.getProp)(entity, "extendedProps.serverExtractCapability");
        downloadFlow = isExtractEnabled ? "fgdb" : "paging";
    }
    else if ((0, canUseExportImageFlow_1.canUseExportImageFlow)(entity)) {
        downloadFlow = "exportImage";
    }
    return downloadFlow;
}
//# sourceMappingURL=getDownloadFlow.js.map