/*!
 * Copyright (C) Microsoft Corporation. All rights reserved.
 */
import { ErrorCodes, PowerDataRuntimeError } from '../error/error';
/**
 * Singleton provider for managing data sources information.
 * @private
 */
class PowerDataSourcesInfoProvider {
    static instance = null;
    dataSourcesInfo;
    /**
     * Private constructor to enforce the singleton pattern.
     * @param dataSourcesInfo The data sources information to initialize the provider with.
     */
    constructor(dataSourcesInfo) {
        this.dataSourcesInfo = dataSourcesInfo;
    }
    /**
     * Retrieves the singleton instance of PowerDataSourcesInfoProvider.
     * If the instance does not exist, it initializes it with the provided data sources info.
     *
     * @param dataSourcesInfo Optional parameter to initialize the instance if it doesn't exist.
     * @returns The singleton instance of PowerDataSourcesInfoProvider.
     * @throws Error if the instance is not initialized and no dataSourcesInfo is provided.
     */
    static getInstance(dataSourcesInfo) {
        if (!this.instance) {
            if (!dataSourcesInfo) {
                throw new PowerDataRuntimeError(ErrorCodes.DataSourcesInfoNotFound);
            }
            this.instance = new PowerDataSourcesInfoProvider(dataSourcesInfo);
        }
        return this.instance;
    }
    /**
     * Retrieves the data sources information.
     *
     * @returns A promise resolving to the data sources information.
     */
    async getDataSourcesInfo() {
        return this.dataSourcesInfo;
    }
}
export default PowerDataSourcesInfoProvider;
//# sourceMappingURL=powerDataSourcesInfoProvider.js.map