"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.shouldShowDownloadsConfiguration = shouldShowDownloadsConfiguration;
const canUseExportImageFlow_1 = require("../../downloads/_internal/canUseExportImageFlow");
const get_prop_1 = require("../../objects/get-prop");
/**
 * @private
 * Determines if the downloads configuration should be shown for an entity.
 *
 * NOTE: product has asked that the download configuration be shown for entities that _can_
 * be downloaded, as well as certain entities that _cannot_ be downloaded currently, but
 * could be downloaded with a change in item / service settings.
 *
 * @param entity entity to check
 * @returns whether downloads configuration should be shown
 */
function shouldShowDownloadsConfiguration(entity) {
    // NOTE: At this time, product has asked that we hide the downloads configuration
    // for multi-layer service entities.
    const isReferenceLayerEntity = ["Feature Service", "Map Service"].includes(entity.type) &&
        /\/\d+$/.test(entity.url);
    const isSingleLayerEntity = (0, get_prop_1.getProp)(entity, "extendedProps.server.layers.length") === 1;
    const isDownloadableImageService = (0, canUseExportImageFlow_1.canUseExportImageFlow)(entity);
    return (isReferenceLayerEntity || isSingleLayerEntity || isDownloadableImageService);
}
//# sourceMappingURL=shouldShowDownloadsConfiguration.js.map