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

/**
 * Partition Reconfiguration event.
 *
 * @extends models['PartitionEvent']
 */
class PartitionReconfiguredEvent extends models['PartitionEvent'] {
  /**
   * Create a PartitionReconfiguredEvent.
   * @property {string} nodeName The name of a Service Fabric node.
   * @property {string} nodeInstanceId Id of Node instance.
   * @property {string} serviceType Type of Service.
   * @property {number} ccEpochDataLossVersion CcEpochDataLoss version.
   * @property {number} ccEpochConfigVersion CcEpochConfig version.
   * @property {string} reconfigType Type of reconfiguration.
   * @property {string} result Describes reconfiguration result.
   * @property {number} phase0DurationMs Duration of Phase0 in milli-seconds.
   * @property {number} phase1DurationMs Duration of Phase1 in milli-seconds.
   * @property {number} phase2DurationMs Duration of Phase2 in milli-seconds.
   * @property {number} phase3DurationMs Duration of Phase3 in milli-seconds.
   * @property {number} phase4DurationMs Duration of Phase4 in milli-seconds.
   * @property {number} totalDurationMs Total duration in milli-seconds.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of PartitionReconfiguredEvent
   *
   * @returns {object} metadata of PartitionReconfiguredEvent
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'PartitionReconfigured',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'Kind',
          clientName: 'kind'
        },
        uberParent: 'FabricEvent',
        className: 'PartitionReconfiguredEvent',
        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'
            }
          },
          nodeName: {
            required: true,
            serializedName: 'NodeName',
            type: {
              name: 'String'
            }
          },
          nodeInstanceId: {
            required: true,
            serializedName: 'NodeInstanceId',
            type: {
              name: 'String'
            }
          },
          serviceType: {
            required: true,
            serializedName: 'ServiceType',
            type: {
              name: 'String'
            }
          },
          ccEpochDataLossVersion: {
            required: true,
            serializedName: 'CcEpochDataLossVersion',
            type: {
              name: 'Number'
            }
          },
          ccEpochConfigVersion: {
            required: true,
            serializedName: 'CcEpochConfigVersion',
            type: {
              name: 'Number'
            }
          },
          reconfigType: {
            required: true,
            serializedName: 'ReconfigType',
            type: {
              name: 'String'
            }
          },
          result: {
            required: true,
            serializedName: 'Result',
            type: {
              name: 'String'
            }
          },
          phase0DurationMs: {
            required: true,
            serializedName: 'Phase0DurationMs',
            type: {
              name: 'Number'
            }
          },
          phase1DurationMs: {
            required: true,
            serializedName: 'Phase1DurationMs',
            type: {
              name: 'Number'
            }
          },
          phase2DurationMs: {
            required: true,
            serializedName: 'Phase2DurationMs',
            type: {
              name: 'Number'
            }
          },
          phase3DurationMs: {
            required: true,
            serializedName: 'Phase3DurationMs',
            type: {
              name: 'Number'
            }
          },
          phase4DurationMs: {
            required: true,
            serializedName: 'Phase4DurationMs',
            type: {
              name: 'Number'
            }
          },
          totalDurationMs: {
            required: true,
            serializedName: 'TotalDurationMs',
            type: {
              name: 'Number'
            }
          }
        }
      }
    };
  }
}

module.exports = PartitionReconfiguredEvent;
