/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

/* jshint latedef:false */
/* jshint forin:false */
/* jshint noempty:false */

'use strict';

const msRest = require('ms-rest');
const msRestAzure = require('ms-rest-azure');
const ServiceClient = msRestAzure.AzureServiceClient;

const models = require('./models');
const operations = require('./operations');


/** Class representing a ApiManagementClient. */
class ApiManagementClient extends ServiceClient {
  /**
   * Create a ApiManagementClient.
   * @param {credentials} credentials - Credentials needed for the client to connect to Azure.
   * @param {string} subscriptionId - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
   * @param {string} [baseUri] - The base URI of the service.
   * @param {object} [options] - The parameter options
   * @param {Array} [options.filters] - Filters to be added to the request pipeline
   * @param {object} [options.requestOptions] - Options for the underlying request object
   * {@link https://github.com/request/request#requestoptions-callback Options doc}
   * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
   * @param {string} [options.acceptLanguage] - The preferred language for the response.
   * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30.
   * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
   */
  constructor(credentials, subscriptionId, baseUri, options) {
    if (credentials === null || credentials === undefined) {
      throw new Error('\'credentials\' cannot be null.');
    }
    if (subscriptionId === null || subscriptionId === undefined) {
      throw new Error('\'subscriptionId\' cannot be null.');
    }

    if (!options) options = {};

    super(credentials, options);

    this.apiVersion = '2019-12-01';
    this.acceptLanguage = 'en-US';
    this.longRunningOperationRetryTimeout = 30;
    this.generateClientRequestId = true;
    this.baseUri = baseUri;
    if (!this.baseUri) {
      this.baseUri = 'https://management.azure.com';
    }
    this.credentials = credentials;
    this.subscriptionId = subscriptionId;

    let packageInfo = this.getPackageJsonInfo(__dirname);
    this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
    if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
      this.acceptLanguage = options.acceptLanguage;
    }
    if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
      this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
    }
    if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) {
      this.generateClientRequestId = options.generateClientRequestId;
    }
    this.api = new operations.Api(this);
    this.apiRevision = new operations.ApiRevision(this);
    this.apiRelease = new operations.ApiRelease(this);
    this.apiOperation = new operations.ApiOperation(this);
    this.apiOperationPolicy = new operations.ApiOperationPolicy(this);
    this.tag = new operations.Tag(this);
    this.apiProduct = new operations.ApiProduct(this);
    this.apiPolicy = new operations.ApiPolicy(this);
    this.apiSchema = new operations.ApiSchema(this);
    this.apiDiagnostic = new operations.ApiDiagnostic(this);
    this.apiIssue = new operations.ApiIssue(this);
    this.apiIssueComment = new operations.ApiIssueComment(this);
    this.apiIssueAttachment = new operations.ApiIssueAttachment(this);
    this.apiTagDescription = new operations.ApiTagDescription(this);
    this.operationOperations = new operations.OperationOperations(this);
    this.apiVersionSet = new operations.ApiVersionSet(this);
    this.authorizationServer = new operations.AuthorizationServer(this);
    this.backend = new operations.Backend(this);
    this.cache = new operations.Cache(this);
    this.certificate = new operations.Certificate(this);
    this.apiManagementOperations = new operations.ApiManagementOperations(this);
    this.apiManagementServiceSkus = new operations.ApiManagementServiceSkus(this);
    this.apiManagementService = new operations.ApiManagementService(this);
    this.diagnostic = new operations.Diagnostic(this);
    this.emailTemplate = new operations.EmailTemplate(this);
    this.gateway = new operations.Gateway(this);
    this.gatewayHostnameConfiguration = new operations.GatewayHostnameConfiguration(this);
    this.gatewayApi = new operations.GatewayApi(this);
    this.group = new operations.Group(this);
    this.groupUser = new operations.GroupUser(this);
    this.identityProvider = new operations.IdentityProvider(this);
    this.issue = new operations.Issue(this);
    this.logger = new operations.Logger(this);
    this.namedValue = new operations.NamedValue(this);
    this.networkStatus = new operations.NetworkStatus(this);
    this.notification = new operations.Notification(this);
    this.notificationRecipientUser = new operations.NotificationRecipientUser(this);
    this.notificationRecipientEmail = new operations.NotificationRecipientEmail(this);
    this.openIdConnectProvider = new operations.OpenIdConnectProvider(this);
    this.policy = new operations.Policy(this);
    this.policyDescription = new operations.PolicyDescription(this);
    this.signInSettings = new operations.SignInSettings(this);
    this.signUpSettings = new operations.SignUpSettings(this);
    this.delegationSettings = new operations.DelegationSettings(this);
    this.product = new operations.Product(this);
    this.productApi = new operations.ProductApi(this);
    this.productGroup = new operations.ProductGroup(this);
    this.productSubscriptions = new operations.ProductSubscriptions(this);
    this.productPolicy = new operations.ProductPolicy(this);
    this.quotaByCounterKeys = new operations.QuotaByCounterKeys(this);
    this.quotaByPeriodKeys = new operations.QuotaByPeriodKeys(this);
    this.region = new operations.Region(this);
    this.reports = new operations.Reports(this);
    this.subscription = new operations.Subscription(this);
    this.tagResource = new operations.TagResource(this);
    this.tenantAccess = new operations.TenantAccess(this);
    this.tenantAccessGit = new operations.TenantAccessGit(this);
    this.tenantConfiguration = new operations.TenantConfiguration(this);
    this.user = new operations.User(this);
    this.userGroup = new operations.UserGroup(this);
    this.userSubscription = new operations.UserSubscription(this);
    this.userIdentities = new operations.UserIdentities(this);
    this.userConfirmationPassword = new operations.UserConfirmationPassword(this);
    this.apiExport = new operations.ApiExport(this);
    this.models = models;
    msRest.addSerializationMixin(this);
  }

}

module.exports = ApiManagementClient;
module.exports['default'] = ApiManagementClient;
module.exports.ApiManagementClient = ApiManagementClient;
module.exports.ApiManagementModels = models;
