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

/**
 * Describes basic retention policy.
 *
 * @extends models['RetentionPolicyDescription']
 */
class BasicRetentionPolicyDescription extends models['RetentionPolicyDescription'] {
  /**
   * Create a BasicRetentionPolicyDescription.
   * @property {moment.duration} retentionDuration It is the minimum duration
   * for which a backup created, will remain stored in the storage and might
   * get deleted after that span of time. It should be specified in ISO8601
   * format.
   * @property {number} [minimumNumberOfBackups] It is the minimum number of
   * backups to be retained at any point of time. If specified with a non zero
   * value, backups will not be deleted even if the backups have gone past
   * retention duration and have number of backups less than or equal to it.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of BasicRetentionPolicyDescription
   *
   * @returns {object} metadata of BasicRetentionPolicyDescription
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Basic',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'RetentionPolicyType',
          clientName: 'retentionPolicyType'
        },
        uberParent: 'RetentionPolicyDescription',
        className: 'BasicRetentionPolicyDescription',
        modelProperties: {
          retentionPolicyType: {
            required: true,
            serializedName: 'RetentionPolicyType',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          retentionDuration: {
            required: true,
            serializedName: 'RetentionDuration',
            type: {
              name: 'TimeSpan'
            }
          },
          minimumNumberOfBackups: {
            required: false,
            serializedName: 'MinimumNumberOfBackups',
            constraints: {
              InclusiveMinimum: 0
            },
            type: {
              name: 'Number'
            }
          }
        }
      }
    };
  }
}

module.exports = BasicRetentionPolicyDescription;
