/*
 * 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');

/**
 * Description of a backup which will be performed.
 *
 * @extends models['ProxyOnlyResource']
 */
class BackupRequest extends models['ProxyOnlyResource'] {
  /**
   * Create a BackupRequest.
   * @member {string} [backupName] Name of the backup.
   * @member {boolean} [enabled] True if the backup schedule is enabled (must
   * be included in that case), false if the backup schedule should be
   * disabled.
   * @member {string} storageAccountUrl SAS URL to the container.
   * @member {object} [backupSchedule] Schedule for the backup if it is
   * executed periodically.
   * @member {number} [backupSchedule.frequencyInterval] How often the backup
   * should be executed (e.g. for weekly backup, this should be set to 7 and
   * FrequencyUnit should be set to Day)
   * @member {string} [backupSchedule.frequencyUnit] The unit of time for how
   * often the backup should be executed (e.g. for weekly backup, this should
   * be set to Day and FrequencyInterval should be set to 7). Possible values
   * include: 'Day', 'Hour'
   * @member {boolean} [backupSchedule.keepAtLeastOneBackup] True if the
   * retention policy should always keep at least one backup in the storage
   * account, regardless how old it is; false otherwise.
   * @member {number} [backupSchedule.retentionPeriodInDays] After how many
   * days backups should be deleted.
   * @member {date} [backupSchedule.startTime] When the schedule should start
   * working.
   * @member {date} [backupSchedule.lastExecutionTime] Last time when this
   * schedule was triggered.
   * @member {array} [databases] Databases included in the backup.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of BackupRequest
   *
   * @returns {object} metadata of BackupRequest
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'BackupRequest',
      type: {
        name: 'Composite',
        className: 'BackupRequest',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          kind: {
            required: false,
            serializedName: 'kind',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          backupName: {
            required: false,
            serializedName: 'properties.backupName',
            type: {
              name: 'String'
            }
          },
          enabled: {
            required: false,
            serializedName: 'properties.enabled',
            type: {
              name: 'Boolean'
            }
          },
          storageAccountUrl: {
            required: true,
            serializedName: 'properties.storageAccountUrl',
            type: {
              name: 'String'
            }
          },
          backupSchedule: {
            required: false,
            serializedName: 'properties.backupSchedule',
            type: {
              name: 'Composite',
              className: 'BackupSchedule'
            }
          },
          databases: {
            required: false,
            serializedName: 'properties.databases',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'DatabaseBackupSettingElementType',
                  type: {
                    name: 'Composite',
                    className: 'DatabaseBackupSetting'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = BackupRequest;
