# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::Cosmosdb::Mgmt::V2020_03_01
  module Models
    #
    # The consistency policy for the Cosmos DB database account.
    #
    class ConsistencyPolicy

      include MsRestAzure

      # @return [DefaultConsistencyLevel] The default consistency level and
      # configuration settings of the Cosmos DB account. Possible values
      # include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong',
      # 'ConsistentPrefix'
      attr_accessor :default_consistency_level

      # @return [Integer] 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'.
      attr_accessor :max_staleness_prefix

      # @return [Integer] 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 5 - 86400. Required when
      # defaultConsistencyPolicy is set to 'BoundedStaleness'.
      attr_accessor :max_interval_in_seconds


      #
      # Mapper for ConsistencyPolicy class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'ConsistencyPolicy',
          type: {
            name: 'Composite',
            class_name: 'ConsistencyPolicy',
            model_properties: {
              default_consistency_level: {
                client_side_validation: true,
                required: true,
                serialized_name: 'defaultConsistencyLevel',
                type: {
                  name: 'Enum',
                  module: 'DefaultConsistencyLevel'
                }
              },
              max_staleness_prefix: {
                client_side_validation: true,
                required: false,
                serialized_name: 'maxStalenessPrefix',
                constraints: {
                  InclusiveMaximum: 2147483647,
                  InclusiveMinimum: 1
                },
                type: {
                  name: 'Number'
                }
              },
              max_interval_in_seconds: {
                client_side_validation: true,
                required: false,
                serialized_name: 'maxIntervalInSeconds',
                constraints: {
                  InclusiveMaximum: 86400,
                  InclusiveMinimum: 5
                },
                type: {
                  name: 'Number'
                }
              }
            }
          }
        }
      end
    end
  end
end
