# 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::ServiceFabric::V6_4_0_36
  module Models
    #
    # Describes a stateful service.
    #
    class StatefulServiceDescription < ServiceDescription

      include MsRestAzure


      def initialize
        @ServiceKind = "Stateful"
      end

      attr_accessor :ServiceKind

      # @return [Integer] The target replica set size as a number.
      attr_accessor :target_replica_set_size

      # @return [Integer] The minimum replica set size as a number.
      attr_accessor :min_replica_set_size

      # @return [Boolean] A flag indicating whether this is a persistent
      # service which stores states on the local disk. If it is then the value
      # of this property is true, if not it is false.
      attr_accessor :has_persisted_state

      # @return [Integer] Flags indicating whether other properties are set.
      # Each of the associated properties corresponds to a flag, specified
      # below, which, if set, indicate that the property is specified.
      # This property can be a combination of those flags obtained using
      # bitwise 'OR' operator.
      # For example, if the provided value is 6 then the flags for
      # QuorumLossWaitDuration (2) and StandByReplicaKeepDuration(4) are set.
      #
      # - None - Does not indicate any other properties are set. The value is
      # zero.
      # - ReplicaRestartWaitDuration - Indicates the ReplicaRestartWaitDuration
      # property is set. The value is 1.
      # - QuorumLossWaitDuration - Indicates the QuorumLossWaitDuration
      # property is set. The value is 2.
      # - StandByReplicaKeepDuration - Indicates the StandByReplicaKeepDuration
      # property is set. The value is 4.
      attr_accessor :flags

      # @return [Integer] The duration, in seconds, between when a replica goes
      # down and when a new replica is created.
      attr_accessor :replica_restart_wait_duration_seconds

      # @return [Integer] The maximum duration, in seconds, for which a
      # partition is allowed to be in a state of quorum loss.
      attr_accessor :quorum_loss_wait_duration_seconds

      # @return [Integer] The definition on how long StandBy replicas should be
      # maintained before being removed.
      attr_accessor :stand_by_replica_keep_duration_seconds


      #
      # Mapper for StatefulServiceDescription class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'Stateful',
          type: {
            name: 'Composite',
            class_name: 'StatefulServiceDescription',
            model_properties: {
              application_name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ApplicationName',
                type: {
                  name: 'String'
                }
              },
              service_name: {
                client_side_validation: true,
                required: true,
                serialized_name: 'ServiceName',
                type: {
                  name: 'String'
                }
              },
              service_type_name: {
                client_side_validation: true,
                required: true,
                serialized_name: 'ServiceTypeName',
                type: {
                  name: 'String'
                }
              },
              initialization_data: {
                client_side_validation: true,
                required: false,
                serialized_name: 'InitializationData',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'NumberElementType',
                      type: {
                        name: 'Number'
                      }
                  }
                }
              },
              partition_description: {
                client_side_validation: true,
                required: true,
                serialized_name: 'PartitionDescription',
                type: {
                  name: 'Composite',
                  polymorphic_discriminator: 'PartitionScheme',
                  uber_parent: 'PartitionSchemeDescription',
                  class_name: 'PartitionSchemeDescription'
                }
              },
              placement_constraints: {
                client_side_validation: true,
                required: false,
                serialized_name: 'PlacementConstraints',
                type: {
                  name: 'String'
                }
              },
              correlation_scheme: {
                client_side_validation: true,
                required: false,
                serialized_name: 'CorrelationScheme',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ServiceCorrelationDescriptionElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'ServiceCorrelationDescription'
                      }
                  }
                }
              },
              service_load_metrics: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ServiceLoadMetrics',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ServiceLoadMetricDescriptionElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'ServiceLoadMetricDescription'
                      }
                  }
                }
              },
              service_placement_policies: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ServicePlacementPolicies',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ServicePlacementPolicyDescriptionElementType',
                      type: {
                        name: 'Composite',
                        polymorphic_discriminator: 'Type',
                        uber_parent: 'ServicePlacementPolicyDescription',
                        class_name: 'ServicePlacementPolicyDescription'
                      }
                  }
                }
              },
              default_move_cost: {
                client_side_validation: true,
                required: false,
                serialized_name: 'DefaultMoveCost',
                type: {
                  name: 'String'
                }
              },
              is_default_move_cost_specified: {
                client_side_validation: true,
                required: false,
                serialized_name: 'IsDefaultMoveCostSpecified',
                type: {
                  name: 'Boolean'
                }
              },
              service_package_activation_mode: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ServicePackageActivationMode',
                type: {
                  name: 'String'
                }
              },
              service_dns_name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ServiceDnsName',
                type: {
                  name: 'String'
                }
              },
              scaling_policies: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ScalingPolicies',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ScalingPolicyDescriptionElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'ScalingPolicyDescription'
                      }
                  }
                }
              },
              ServiceKind: {
                client_side_validation: true,
                required: true,
                serialized_name: 'ServiceKind',
                type: {
                  name: 'String'
                }
              },
              target_replica_set_size: {
                client_side_validation: true,
                required: true,
                serialized_name: 'TargetReplicaSetSize',
                constraints: {
                  InclusiveMinimum: 1
                },
                type: {
                  name: 'Number'
                }
              },
              min_replica_set_size: {
                client_side_validation: true,
                required: true,
                serialized_name: 'MinReplicaSetSize',
                constraints: {
                  InclusiveMinimum: 1
                },
                type: {
                  name: 'Number'
                }
              },
              has_persisted_state: {
                client_side_validation: true,
                required: true,
                serialized_name: 'HasPersistedState',
                type: {
                  name: 'Boolean'
                }
              },
              flags: {
                client_side_validation: true,
                required: false,
                serialized_name: 'Flags',
                type: {
                  name: 'Number'
                }
              },
              replica_restart_wait_duration_seconds: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ReplicaRestartWaitDurationSeconds',
                constraints: {
                  InclusiveMaximum: 4294967295,
                  InclusiveMinimum: 0
                },
                type: {
                  name: 'Number'
                }
              },
              quorum_loss_wait_duration_seconds: {
                client_side_validation: true,
                required: false,
                serialized_name: 'QuorumLossWaitDurationSeconds',
                constraints: {
                  InclusiveMaximum: 4294967295,
                  InclusiveMinimum: 0
                },
                type: {
                  name: 'Number'
                }
              },
              stand_by_replica_keep_duration_seconds: {
                client_side_validation: true,
                required: false,
                serialized_name: 'StandByReplicaKeepDurationSeconds',
                constraints: {
                  InclusiveMaximum: 4294967295,
                  InclusiveMinimum: 0
                },
                type: {
                  name: 'Number'
                }
              }
            }
          }
        }
      end
    end
  end
end
