/*
 * 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.
 */

'use strict';

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

/**
 * Azure VM (Mercury) workload-specific backup policy.
 *
 * @extends models['ProtectionPolicy']
 */
class AzureVmWorkloadProtectionPolicy extends models['ProtectionPolicy'] {
  /**
   * Create a AzureVmWorkloadProtectionPolicy.
   * @member {string} [workLoadType] Type of workload for the backup
   * management. Possible values include: 'Invalid', 'VM', 'FileFolder',
   * 'AzureSqlDb', 'SQLDB', 'Exchange', 'Sharepoint', 'VMwareVM',
   * 'SystemState', 'Client', 'GenericDataSource', 'SQLDataBase',
   * 'AzureFileShare', 'SAPHanaDatabase'
   * @member {object} [settings] Common settings for the backup management
   * @member {string} [settings.timeZone] TimeZone optional input as string.
   * For example: TimeZone = "Pacific Standard Time".
   * @member {boolean} [settings.issqlcompression] SQL compression flag
   * @member {boolean} [settings.isCompression] Workload compression flag. This
   * has been added so that 'isSqlCompression'
   * will be deprecated once clients upgrade to consider this flag.
   * @member {array} [subProtectionPolicy] List of sub-protection policies
   * which includes schedule and retention
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of AzureVmWorkloadProtectionPolicy
   *
   * @returns {object} metadata of AzureVmWorkloadProtectionPolicy
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'AzureWorkload',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'backupManagementType',
          clientName: 'backupManagementType'
        },
        uberParent: 'ProtectionPolicy',
        className: 'AzureVmWorkloadProtectionPolicy',
        modelProperties: {
          protectedItemsCount: {
            required: false,
            serializedName: 'protectedItemsCount',
            type: {
              name: 'Number'
            }
          },
          backupManagementType: {
            required: true,
            serializedName: 'backupManagementType',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          workLoadType: {
            required: false,
            serializedName: 'workLoadType',
            type: {
              name: 'String'
            }
          },
          settings: {
            required: false,
            serializedName: 'settings',
            type: {
              name: 'Composite',
              className: 'Settings'
            }
          },
          subProtectionPolicy: {
            required: false,
            serializedName: 'subProtectionPolicy',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'SubProtectionPolicyElementType',
                  type: {
                    name: 'Composite',
                    className: 'SubProtectionPolicy'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = AzureVmWorkloadProtectionPolicy;
