"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CesiumIonAssetProvider = void 0;
/**
 * This class provide methods used to interpret url to a cesiumIon asset (RealityDataProvider.CesiumIonAsset)
 */
class CesiumIonAssetProvider {
    static osmBuildingId = "OSMBuildings";
    /** Return true if this is a supported url to this service provider */
    static isProviderUrl(url) {
        return url.includes("$CesiumIonAsset=");
    }
    // TBD - Allow an object to override the URL and provide its own authentication.
    static parseCesiumUrl(url) {
        const cesiumSuffix = "$CesiumIonAsset=";
        const cesiumIndex = url.indexOf(cesiumSuffix);
        if (cesiumIndex < 0)
            return undefined;
        const cesiumIonString = url.slice(cesiumIndex + cesiumSuffix.length);
        const cesiumParts = cesiumIonString.split(":");
        if (cesiumParts.length !== 2)
            return undefined;
        const id = parseInt(cesiumParts[0], 10);
        if (id === undefined)
            return undefined;
        return { id, key: cesiumParts[1] };
    }
}
exports.CesiumIonAssetProvider = CesiumIonAssetProvider;
//# sourceMappingURL=CesiumAssetProvider.js.map