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

/**
 * Service Created event.
 *
 * @extends models['ServiceEvent']
 */
class ServiceCreatedEvent extends models['ServiceEvent'] {
  /**
   * Create a ServiceCreatedEvent.
   * @property {string} serviceTypeName Service type name.
   * @property {string} applicationName Application name.
   * @property {string} applicationTypeName Application type name.
   * @property {number} serviceInstance Id of Service instance.
   * @property {boolean} isStateful Indicates if Service is stateful.
   * @property {number} partitionCount Number of partitions.
   * @property {number} targetReplicaSetSize Size of target replicas set.
   * @property {number} minReplicaSetSize Minimum size of replicas set.
   * @property {string} servicePackageVersion Version of Service package.
   * @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.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ServiceCreatedEvent
   *
   * @returns {object} metadata of ServiceCreatedEvent
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ServiceCreated',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'Kind',
          clientName: 'kind'
        },
        uberParent: 'FabricEvent',
        className: 'ServiceCreatedEvent',
        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'
            }
          },
          serviceId: {
            required: true,
            serializedName: 'ServiceId',
            type: {
              name: 'String'
            }
          },
          serviceTypeName: {
            required: true,
            serializedName: 'ServiceTypeName',
            type: {
              name: 'String'
            }
          },
          applicationName: {
            required: true,
            serializedName: 'ApplicationName',
            type: {
              name: 'String'
            }
          },
          applicationTypeName: {
            required: true,
            serializedName: 'ApplicationTypeName',
            type: {
              name: 'String'
            }
          },
          serviceInstance: {
            required: true,
            serializedName: 'ServiceInstance',
            type: {
              name: 'Number'
            }
          },
          isStateful: {
            required: true,
            serializedName: 'IsStateful',
            type: {
              name: 'Boolean'
            }
          },
          partitionCount: {
            required: true,
            serializedName: 'PartitionCount',
            type: {
              name: 'Number'
            }
          },
          targetReplicaSetSize: {
            required: true,
            serializedName: 'TargetReplicaSetSize',
            type: {
              name: 'Number'
            }
          },
          minReplicaSetSize: {
            required: true,
            serializedName: 'MinReplicaSetSize',
            type: {
              name: 'Number'
            }
          },
          servicePackageVersion: {
            required: true,
            serializedName: 'ServicePackageVersion',
            type: {
              name: 'String'
            }
          },
          partitionId: {
            required: true,
            serializedName: 'PartitionId',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = ServiceCreatedEvent;
