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

/**
 * @class
 * Initializes a new instance of the ConsistencyPolicy class.
 * @constructor
 * The consistency policy for the DocumentDB database account.
 *
 * @member {string} defaultConsistencyLevel The default consistency level and
 * configuration settings of the DocumentDB account. Possible values include:
 * 'Eventual', 'Session', 'BoundedStaleness', 'Strong'
 *
 * @member {number} [maxStalenessPrefix] When used with the Bounded Staleness
 * consistency level, this value represents the number of stale requests
 * tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when
 * defaultConsistencyPolicy is set to 'BoundedStaleness'.
 *
 * @member {number} [maxIntervalInSeconds] When used with the Bounded Staleness
 * consistency level, this value represents the time amount of staleness (in
 * seconds) tolerated. Accepted range for this value is 1 - 100. Required when
 * defaultConsistencyPolicy is set to 'BoundedStaleness'.
 *
 */
class ConsistencyPolicy {
  constructor() {
  }

  /**
   * Defines the metadata of ConsistencyPolicy
   *
   * @returns {object} metadata of ConsistencyPolicy
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ConsistencyPolicy',
      type: {
        name: 'Composite',
        className: 'ConsistencyPolicy',
        modelProperties: {
          defaultConsistencyLevel: {
            required: true,
            serializedName: 'defaultConsistencyLevel',
            type: {
              name: 'Enum',
              allowedValues: [ 'Eventual', 'Session', 'BoundedStaleness', 'Strong' ]
            }
          },
          maxStalenessPrefix: {
            required: false,
            serializedName: 'maxStalenessPrefix',
            constraints: {
              InclusiveMaximum: 2147483647,
              InclusiveMinimum: 1
            },
            type: {
              name: 'Number'
            }
          },
          maxIntervalInSeconds: {
            required: false,
            serializedName: 'maxIntervalInSeconds',
            constraints: {
              InclusiveMaximum: 100,
              InclusiveMinimum: 1
            },
            type: {
              name: 'Number'
            }
          }
        }
      }
    };
  }
}

module.exports = ConsistencyPolicy;
