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

/**
 * Information about a stateful replica running in a code package. Note
 * DeployedServiceReplicaQueryResult will contain duplicate data like
 * ServiceKind, ServiceName, PartitionId and replicaId.
 *
 * @extends models['DeployedServiceReplicaDetailInfo']
 */
class DeployedStatefulServiceReplicaDetailInfo extends models['DeployedServiceReplicaDetailInfo'] {
  /**
   * Create a DeployedStatefulServiceReplicaDetailInfo.
   * @property {string} [replicaId] Id of a stateful service replica. ReplicaId
   * is used by Service Fabric to uniquely identify a replica of a partition.
   * It is unique within a partition and does not change for the lifetime of
   * the replica. If a replica gets dropped and another replica gets created on
   * the same node for the same partition, it will get a different value for
   * the id. Sometimes the id of a stateless service instance is also referred
   * as a replica id.
   * @property {string} [currentReplicatorOperation] Specifies the operation
   * currently being executed by the Replicator. Possible values include:
   * 'Invalid', 'None', 'Open', 'ChangeRole', 'UpdateEpoch', 'Close', 'Abort',
   * 'OnDataLoss', 'WaitForCatchup', 'Build'
   * @property {string} [readStatus] Specifies the access status of the
   * partition. Possible values include: 'Invalid', 'Granted',
   * 'ReconfigurationPending', 'NotPrimary', 'NoWriteQuorum'
   * @property {string} [writeStatus] Specifies the access status of the
   * partition. Possible values include: 'Invalid', 'Granted',
   * 'ReconfigurationPending', 'NotPrimary', 'NoWriteQuorum'
   * @property {object} [replicatorStatus] Represents a base class for primary
   * or secondary replicator status.
   * Contains information about the service fabric replicator like the
   * replication/copy queue utilization, last acknowledgement received
   * timestamp, etc.
   * @property {string} [replicatorStatus.kind] Polymorphic Discriminator
   * @property {object} [replicaStatus] Key value store related information for
   * the replica.
   * @property {string} [replicaStatus.databaseRowCountEstimate] Value
   * indicating the estimated number of rows in the underlying database.
   * @property {string} [replicaStatus.databaseLogicalSizeEstimate] Value
   * indicating the estimated size of the underlying database.
   * @property {string} [replicaStatus.copyNotificationCurrentKeyFilter] Value
   * indicating the latest key-prefix filter applied to enumeration during the
   * callback. Null if there is no pending callback.
   * @property {string} [replicaStatus.copyNotificationCurrentProgress] Value
   * indicating the latest number of keys enumerated during the callback. 0 if
   * there is no pending callback.
   * @property {string} [replicaStatus.statusDetails] Value indicating the
   * current status details of the replica.
   * @property {object} [deployedServiceReplicaQueryResult] Information about a
   * stateful service replica deployed on a node.
   * @property {string} [deployedServiceReplicaQueryResult.replicaId] Id of a
   * stateful service replica. ReplicaId is used by Service Fabric to uniquely
   * identify a replica of a partition. It is unique within a partition and
   * does not change for the lifetime of the replica. If a replica gets dropped
   * and another replica gets created on the same node for the same partition,
   * it will get a different value for the id. Sometimes the id of a stateless
   * service instance is also referred as a replica id.
   * @property {string} [deployedServiceReplicaQueryResult.replicaRole] The
   * role of a replica of a stateful service. Possible values include:
   * 'Unknown', 'None', 'Primary', 'IdleSecondary', 'ActiveSecondary'
   * @property {object}
   * [deployedServiceReplicaQueryResult.reconfigurationInformation] Information
   * about current reconfiguration like phase, type, previous configuration
   * role of replica and reconfiguration start date time.
   * @property {string}
   * [deployedServiceReplicaQueryResult.reconfigurationInformation.previousConfigurationRole]
   * Replica role before reconfiguration started. Possible values include:
   * 'Unknown', 'None', 'Primary', 'IdleSecondary', 'ActiveSecondary'
   * @property {string}
   * [deployedServiceReplicaQueryResult.reconfigurationInformation.reconfigurationPhase]
   * Current phase of ongoing reconfiguration. If no reconfiguration is taking
   * place then this value will be "None". Possible values include: 'Unknown',
   * 'None', 'Phase0', 'Phase1', 'Phase2', 'Phase3', 'Phase4', 'AbortPhaseZero'
   * @property {string}
   * [deployedServiceReplicaQueryResult.reconfigurationInformation.reconfigurationType]
   * Type of current ongoing reconfiguration. If no reconfiguration is taking
   * place then this value will be "None". Possible values include: 'Unknown',
   * 'SwapPrimary', 'Failover', 'Other'
   * @property {date}
   * [deployedServiceReplicaQueryResult.reconfigurationInformation.reconfigurationStartTimeUtc]
   * Start time (in UTC) of the ongoing reconfiguration. If no reconfiguration
   * is taking place then this value will be zero date-time.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of DeployedStatefulServiceReplicaDetailInfo
   *
   * @returns {object} metadata of DeployedStatefulServiceReplicaDetailInfo
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Stateful',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'ServiceKind',
          clientName: 'serviceKind'
        },
        uberParent: 'DeployedServiceReplicaDetailInfo',
        className: 'DeployedStatefulServiceReplicaDetailInfo',
        modelProperties: {
          serviceName: {
            required: false,
            serializedName: 'ServiceName',
            type: {
              name: 'String'
            }
          },
          partitionId: {
            required: false,
            serializedName: 'PartitionId',
            type: {
              name: 'String'
            }
          },
          currentServiceOperation: {
            required: false,
            serializedName: 'CurrentServiceOperation',
            type: {
              name: 'String'
            }
          },
          currentServiceOperationStartTimeUtc: {
            required: false,
            serializedName: 'CurrentServiceOperationStartTimeUtc',
            type: {
              name: 'DateTime'
            }
          },
          reportedLoad: {
            required: false,
            serializedName: 'ReportedLoad',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'LoadMetricReportInfoElementType',
                  type: {
                    name: 'Composite',
                    className: 'LoadMetricReportInfo'
                  }
              }
            }
          },
          serviceKind: {
            required: true,
            serializedName: 'ServiceKind',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          replicaId: {
            required: false,
            serializedName: 'ReplicaId',
            type: {
              name: 'String'
            }
          },
          currentReplicatorOperation: {
            required: false,
            serializedName: 'CurrentReplicatorOperation',
            type: {
              name: 'String'
            }
          },
          readStatus: {
            required: false,
            serializedName: 'ReadStatus',
            type: {
              name: 'String'
            }
          },
          writeStatus: {
            required: false,
            serializedName: 'WriteStatus',
            type: {
              name: 'String'
            }
          },
          replicatorStatus: {
            required: false,
            serializedName: 'ReplicatorStatus',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: 'Kind',
                clientName: 'kind'
              },
              uberParent: 'ReplicatorStatus',
              className: 'ReplicatorStatus'
            }
          },
          replicaStatus: {
            required: false,
            serializedName: 'ReplicaStatus',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: 'Kind',
                clientName: 'kind'
              },
              uberParent: 'ReplicaStatusBase',
              className: 'KeyValueStoreReplicaStatus'
            }
          },
          deployedServiceReplicaQueryResult: {
            required: false,
            serializedName: 'DeployedServiceReplicaQueryResult',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: 'ServiceKind',
                clientName: 'serviceKind'
              },
              uberParent: 'DeployedServiceReplicaInfo',
              className: 'DeployedStatefulServiceReplicaInfo'
            }
          }
        }
      }
    };
  }
}

module.exports = DeployedStatefulServiceReplicaDetailInfo;
