/*
 * 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 SqlManagementClient. */
class SqlManagementClient extends ServiceClient {
  /**
   * Create a SqlManagementClient.
   * @param {credentials} credentials - Credentials needed for the client to connect to Azure.
   * @param {string} subscriptionId - The subscription ID that identifies an Azure subscription.
   * @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.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.recoverableDatabases = new operations.RecoverableDatabases(this);
    this.restorableDroppedDatabases = new operations.RestorableDroppedDatabases(this);
    this.servers = new operations.Servers(this);
    this.serverConnectionPolicies = new operations.ServerConnectionPolicies(this);
    this.databaseThreatDetectionPolicies = new operations.DatabaseThreatDetectionPolicies(this);
    this.dataMaskingPolicies = new operations.DataMaskingPolicies(this);
    this.dataMaskingRules = new operations.DataMaskingRules(this);
    this.firewallRules = new operations.FirewallRules(this);
    this.geoBackupPolicies = new operations.GeoBackupPolicies(this);
    this.databases = new operations.Databases(this);
    this.elasticPools = new operations.ElasticPools(this);
    this.recommendedElasticPools = new operations.RecommendedElasticPools(this);
    this.replicationLinks = new operations.ReplicationLinks(this);
    this.serverAzureADAdministrators = new operations.ServerAzureADAdministrators(this);
    this.serverCommunicationLinks = new operations.ServerCommunicationLinks(this);
    this.serviceObjectives = new operations.ServiceObjectives(this);
    this.elasticPoolActivities = new operations.ElasticPoolActivities(this);
    this.elasticPoolDatabaseActivities = new operations.ElasticPoolDatabaseActivities(this);
    this.serviceTierAdvisors = new operations.ServiceTierAdvisors(this);
    this.transparentDataEncryptions = new operations.TransparentDataEncryptions(this);
    this.transparentDataEncryptionActivities = new operations.TransparentDataEncryptionActivities(this);
    this.serverUsages = new operations.ServerUsages(this);
    this.databaseUsages = new operations.DatabaseUsages(this);
    this.databaseAutomaticTuningOperations = new operations.DatabaseAutomaticTuningOperations(this);
    this.encryptionProtectors = new operations.EncryptionProtectors(this);
    this.failoverGroups = new operations.FailoverGroups(this);
    this.managedInstances = new operations.ManagedInstances(this);
    this.operations = new operations.Operations(this);
    this.serverKeys = new operations.ServerKeys(this);
    this.syncAgents = new operations.SyncAgents(this);
    this.syncGroups = new operations.SyncGroups(this);
    this.syncMembers = new operations.SyncMembers(this);
    this.subscriptionUsages = new operations.SubscriptionUsages(this);
    this.virtualClusters = new operations.VirtualClusters(this);
    this.virtualNetworkRules = new operations.VirtualNetworkRules(this);
    this.extendedDatabaseBlobAuditingPolicies = new operations.ExtendedDatabaseBlobAuditingPolicies(this);
    this.extendedServerBlobAuditingPolicies = new operations.ExtendedServerBlobAuditingPolicies(this);
    this.serverBlobAuditingPolicies = new operations.ServerBlobAuditingPolicies(this);
    this.databaseBlobAuditingPolicies = new operations.DatabaseBlobAuditingPolicies(this);
    this.databaseVulnerabilityAssessmentRuleBaselines = new operations.DatabaseVulnerabilityAssessmentRuleBaselines(this);
    this.databaseVulnerabilityAssessments = new operations.DatabaseVulnerabilityAssessments(this);
    this.jobAgents = new operations.JobAgents(this);
    this.jobCredentials = new operations.JobCredentials(this);
    this.jobExecutions = new operations.JobExecutions(this);
    this.jobs = new operations.Jobs(this);
    this.jobStepExecutions = new operations.JobStepExecutions(this);
    this.jobSteps = new operations.JobSteps(this);
    this.jobTargetExecutions = new operations.JobTargetExecutions(this);
    this.jobTargetGroups = new operations.JobTargetGroups(this);
    this.jobVersions = new operations.JobVersions(this);
    this.longTermRetentionBackups = new operations.LongTermRetentionBackups(this);
    this.backupLongTermRetentionPolicies = new operations.BackupLongTermRetentionPolicies(this);
    this.managedBackupShortTermRetentionPolicies = new operations.ManagedBackupShortTermRetentionPolicies(this);
    this.managedDatabases = new operations.ManagedDatabases(this);
    this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = new operations.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(this);
    this.serverAutomaticTuningOperations = new operations.ServerAutomaticTuningOperations(this);
    this.serverDnsAliases = new operations.ServerDnsAliases(this);
    this.serverSecurityAlertPolicies = new operations.ServerSecurityAlertPolicies(this);
    this.restorableDroppedManagedDatabases = new operations.RestorableDroppedManagedDatabases(this);
    this.restorePoints = new operations.RestorePoints(this);
    this.managedDatabaseSecurityAlertPolicies = new operations.ManagedDatabaseSecurityAlertPolicies(this);
    this.managedServerSecurityAlertPolicies = new operations.ManagedServerSecurityAlertPolicies(this);
    this.sensitivityLabels = new operations.SensitivityLabels(this);
    this.databaseOperations = new operations.DatabaseOperations(this);
    this.elasticPoolOperations = new operations.ElasticPoolOperations(this);
    this.capabilities = new operations.Capabilities(this);
    this.databaseVulnerabilityAssessmentScans = new operations.DatabaseVulnerabilityAssessmentScans(this);
    this.managedDatabaseVulnerabilityAssessmentRuleBaselines = new operations.ManagedDatabaseVulnerabilityAssessmentRuleBaselines(this);
    this.managedDatabaseVulnerabilityAssessmentScans = new operations.ManagedDatabaseVulnerabilityAssessmentScans(this);
    this.managedDatabaseVulnerabilityAssessments = new operations.ManagedDatabaseVulnerabilityAssessments(this);
    this.instanceFailoverGroups = new operations.InstanceFailoverGroups(this);
    this.backupShortTermRetentionPolicies = new operations.BackupShortTermRetentionPolicies(this);
    this.tdeCertificates = new operations.TdeCertificates(this);
    this.managedInstanceTdeCertificates = new operations.ManagedInstanceTdeCertificates(this);
    this.managedInstanceKeys = new operations.ManagedInstanceKeys(this);
    this.managedInstanceEncryptionProtectors = new operations.ManagedInstanceEncryptionProtectors(this);
    this.recoverableManagedDatabases = new operations.RecoverableManagedDatabases(this);
    this.managedInstanceVulnerabilityAssessments = new operations.ManagedInstanceVulnerabilityAssessments(this);
    this.serverVulnerabilityAssessments = new operations.ServerVulnerabilityAssessments(this);
    this.managedDatabaseSensitivityLabels = new operations.ManagedDatabaseSensitivityLabels(this);
    this.models = models;
    msRest.addSerializationMixin(this);
  }

}

module.exports = SqlManagementClient;
module.exports['default'] = SqlManagementClient;
module.exports.SqlManagementClient = SqlManagementClient;
module.exports.SqlManagementModels = models;
