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

/**
 * Provides statistics about the Service Fabric Replicator, when it is
 * functioning in a ActiveSecondary role.
 *
 * @extends models['ReplicatorStatus']
 */
class SecondaryReplicatorStatus extends models['ReplicatorStatus'] {
  /**
   * Create a SecondaryReplicatorStatus.
   * @property {object} [replicationQueueStatus] Details about the replication
   * queue on the secondary replicator.
   * @property {number} [replicationQueueStatus.queueUtilizationPercentage]
   * Represents the utilization of the queue. A value of 0 indicates that the
   * queue is empty and a value of 100 indicates the queue is full.
   * @property {string} [replicationQueueStatus.queueMemorySize] Represents the
   * virtual memory consumed by the queue in bytes.
   * @property {string} [replicationQueueStatus.firstSequenceNumber] On a
   * primary replicator, this is semantically the sequence number of the
   * operation for which all the secondary replicas have sent an
   * acknowledgement.
   * On a secondary replicator, this is the smallest sequence number of the
   * operation that is present in the queue.
   * @property {string} [replicationQueueStatus.completedSequenceNumber] On a
   * primary replicator, this is semantically the highest sequence number of
   * the operation for which all the secondary replicas have sent an
   * acknowledgement.
   * On a secondary replicator, this is semantically the highest sequence
   * number that has been applied to the persistent state.
   * @property {string} [replicationQueueStatus.committedSequenceNumber] On a
   * primary replicator, this is semantically the highest sequence number of
   * the operation for which a write quorum of the secondary replicas have sent
   * an acknowledgement.
   * On a secondary replicator, this is semantically the highest sequence
   * number of the in-order operation received from the primary.
   * @property {string} [replicationQueueStatus.lastSequenceNumber] Represents
   * the latest sequence number of the operation that is available in the
   * queue.
   * @property {date} [lastReplicationOperationReceivedTimeUtc] The last
   * time-stamp (UTC) at which a replication operation was received from the
   * primary.
   * UTC 0 represents an invalid value, indicating that a replication operation
   * message was never received.
   * @property {boolean} [isInBuild] Value that indicates whether the replica
   * is currently being built.
   * @property {object} [copyQueueStatus] Details about the copy queue on the
   * secondary replicator.
   * @property {number} [copyQueueStatus.queueUtilizationPercentage] Represents
   * the utilization of the queue. A value of 0 indicates that the queue is
   * empty and a value of 100 indicates the queue is full.
   * @property {string} [copyQueueStatus.queueMemorySize] Represents the
   * virtual memory consumed by the queue in bytes.
   * @property {string} [copyQueueStatus.firstSequenceNumber] On a primary
   * replicator, this is semantically the sequence number of the operation for
   * which all the secondary replicas have sent an acknowledgement.
   * On a secondary replicator, this is the smallest sequence number of the
   * operation that is present in the queue.
   * @property {string} [copyQueueStatus.completedSequenceNumber] On a primary
   * replicator, this is semantically the highest sequence number of the
   * operation for which all the secondary replicas have sent an
   * acknowledgement.
   * On a secondary replicator, this is semantically the highest sequence
   * number that has been applied to the persistent state.
   * @property {string} [copyQueueStatus.committedSequenceNumber] On a primary
   * replicator, this is semantically the highest sequence number of the
   * operation for which a write quorum of the secondary replicas have sent an
   * acknowledgement.
   * On a secondary replicator, this is semantically the highest sequence
   * number of the in-order operation received from the primary.
   * @property {string} [copyQueueStatus.lastSequenceNumber] Represents the
   * latest sequence number of the operation that is available in the queue.
   * @property {date} [lastCopyOperationReceivedTimeUtc] The last time-stamp
   * (UTC) at which a copy operation was received from the primary.
   * UTC 0 represents an invalid value, indicating that a copy operation
   * message was never received.
   * @property {date} [lastAcknowledgementSentTimeUtc] The last time-stamp
   * (UTC) at which an acknowledgment was sent to the primary replicator.
   * UTC 0 represents an invalid value, indicating that an acknowledgment
   * message was never sent.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of SecondaryReplicatorStatus
   *
   * @returns {object} metadata of SecondaryReplicatorStatus
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'SecondaryReplicatorStatus',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'Kind',
          clientName: 'kind'
        },
        uberParent: 'ReplicatorStatus',
        className: 'SecondaryReplicatorStatus',
        modelProperties: {
          kind: {
            required: true,
            serializedName: 'Kind',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          replicationQueueStatus: {
            required: false,
            serializedName: 'ReplicationQueueStatus',
            type: {
              name: 'Composite',
              className: 'ReplicatorQueueStatus'
            }
          },
          lastReplicationOperationReceivedTimeUtc: {
            required: false,
            serializedName: 'LastReplicationOperationReceivedTimeUtc',
            type: {
              name: 'DateTime'
            }
          },
          isInBuild: {
            required: false,
            serializedName: 'IsInBuild',
            type: {
              name: 'Boolean'
            }
          },
          copyQueueStatus: {
            required: false,
            serializedName: 'CopyQueueStatus',
            type: {
              name: 'Composite',
              className: 'ReplicatorQueueStatus'
            }
          },
          lastCopyOperationReceivedTimeUtc: {
            required: false,
            serializedName: 'LastCopyOperationReceivedTimeUtc',
            type: {
              name: 'DateTime'
            }
          },
          lastAcknowledgementSentTimeUtc: {
            required: false,
            serializedName: 'LastAcknowledgementSentTimeUtc',
            type: {
              name: 'DateTime'
            }
          }
        }
      }
    };
  }
}

module.exports = SecondaryReplicatorStatus;
