"use strict";
/**
 * Copyright 2014 IBM Corp. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var __assign = (this && this.__assign) || Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
        s = arguments[i];
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
            t[p] = s[p];
    }
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * @module watson-developer-cloud
 */
exports.AuthorizationV1 = require("./authorization/v1");
exports.AssistantV1 = require("./assistant/v1-generated");
exports.ConversationV1 = require("./conversation/v1");
exports.DiscoveryV1 = require("./discovery/v1");
exports.DialogV1 = require("./dialog/v1");
exports.LanguageTranslatorV2 = require("./language-translator/v2");
exports.NaturalLanguageClassifierV1 = require("./natural-language-classifier/v1");
exports.NaturalLanguageUnderstandingV1 = require("./natural-language-understanding/v1");
exports.PersonalityInsightsV2 = require("./personality-insights/v2");
exports.PersonalityInsightsV3 = require("./personality-insights/v3");
exports.SpeechToTextV1 = require("./speech-to-text/v1");
exports.TextToSpeechV1 = require("./text-to-speech/v1");
exports.ToneAnalyzerV3 = require("./tone-analyzer/v3");
exports.VisualRecognitionV3 = require("./visual-recognition/v3");
// adding shim constructors for backwards compatibility
// 2-d map of snake_case service names & version => constructor function
// e.g. servicesByVersion.text_to_speech.v1 === export import TextToSpeechV1;
var servicesByVersion = {};
Object.keys(exports).forEach(function (key) {
    var service = exports[key];
    var name = service.prototype.name;
    var version = service.prototype.serviceVersion;
    servicesByVersion[name] = servicesByVersion[name] || {};
    servicesByVersion[name][version] = service;
});
Object.keys(servicesByVersion).forEach(function (serviceName) {
    Object.defineProperty(exports, serviceName, {
        enumerable: false,
        configurable: true,
        writable: true,
        value: function (options) {
            // eslint-disable-next-line no-console
            console.warn('WARNING: This method of instantiating the Watson services has been deprecated ' +
                'beginning with Version 3.0.0 of the Node SDK.  Please refer to the Node SDK ' +
                'documentation for information on how to instantiate Watson services.  This ' +
                'form of service instantiaion will be removed in a future release of the SDK.');
            options = options || {};
            // previously, AlchemyAPI did not require a version to be specified
            if (serviceName.indexOf('alchemy_') === 0) {
                options.version = 'v1';
            }
            var service = servicesByVersion[serviceName][options.version];
            if (!service) {
                throw new Error('Unable to find ' + serviceName + ' version ' + options.version);
            }
            return new service(__assign({}, options, { serviceVersion: options.version, version: options.version_date }));
        }
    });
});
// removed services
// we don't want these services listed (so non-enumerable), but we do want a clear error message
// if old code happens to try using one
[
    'concept_insights',
    'relationship_extraction',
    'message_resonance',
    'question_and_answer',
    'visual_insights',
    'concept_expansion',
    'retrieve_and_rank',
    'alchemy_language',
    'alchemy_data_news',
    'tradeoff_analytics'
].forEach(function (serviceName) {
    Object.defineProperty(exports, serviceName, {
        enumerable: false,
        configurable: true,
        writable: true,
        value: function () {
            throw new Error('The ' + serviceName + ' service is no longer available');
        }
    });
});
['AlchemyVisionV1', 'alchemy_vision'].forEach(function (serviceName) {
    Object.defineProperty(exports, serviceName, {
        enumerable: false,
        configurable: true,
        writable: true,
        value: function () {
            throw new Error('The Alchemy Vision service is no longer available, please use Visual Recognition instead.');
        }
    });
});
//# sourceMappingURL=index.js.map