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

/**
 * Represents the base for all Replica Events.
 *
 * @extends models['FabricEvent']
 */
class ReplicaEvent extends models['FabricEvent'] {
  /**
   * Create a ReplicaEvent.
   * @property {uuid} partitionId An internal ID used by Service Fabric to
   * uniquely identify a partition. This is a randomly generated GUID when the
   * service was created. The partition ID is unique and does not change for
   * the lifetime of the service. If the same service was deleted and recreated
   * the IDs of its partitions would be different.
   * @property {number} 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.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ReplicaEvent
   *
   * @returns {object} metadata of ReplicaEvent
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ReplicaEvent',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'Kind',
          clientName: 'kind'
        },
        uberParent: 'FabricEvent',
        className: 'ReplicaEvent',
        modelProperties: {
          eventInstanceId: {
            required: true,
            serializedName: 'EventInstanceId',
            type: {
              name: 'String'
            }
          },
          category: {
            required: false,
            serializedName: 'Category',
            type: {
              name: 'String'
            }
          },
          timeStamp: {
            required: true,
            serializedName: 'TimeStamp',
            type: {
              name: 'DateTime'
            }
          },
          hasCorrelatedEvents: {
            required: false,
            serializedName: 'HasCorrelatedEvents',
            type: {
              name: 'Boolean'
            }
          },
          kind: {
            required: true,
            serializedName: 'Kind',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          partitionId: {
            required: true,
            serializedName: 'PartitionId',
            type: {
              name: 'String'
            }
          },
          replicaId: {
            required: true,
            serializedName: 'ReplicaId',
            type: {
              name: 'Number'
            }
          }
        }
      }
    };
  }
}

module.exports = ReplicaEvent;
