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

/**
 * Information about a service partition and its associated endpoints.
 *
 */
class ResolvedServicePartition {
  /**
   * Create a ResolvedServicePartition.
   * @property {string} name The full name of the service with 'fabric:' URI
   * scheme.
   * @property {object} partitionInformation A representation of the resolved
   * partition.
   * @property {uuid} [partitionInformation.id] 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 {string} [partitionInformation.servicePartitionKind] Polymorphic
   * Discriminator
   * @property {array} endpoints List of resolved service endpoints of a
   * service partition.
   * @property {string} version The version of this resolved service partition
   * result. This version should be passed in the next time the ResolveService
   * call is made via the PreviousRspVersion query parameter.
   */
  constructor() {
  }

  /**
   * Defines the metadata of ResolvedServicePartition
   *
   * @returns {object} metadata of ResolvedServicePartition
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ResolvedServicePartition',
      type: {
        name: 'Composite',
        className: 'ResolvedServicePartition',
        modelProperties: {
          name: {
            required: true,
            serializedName: 'Name',
            type: {
              name: 'String'
            }
          },
          partitionInformation: {
            required: true,
            serializedName: 'PartitionInformation',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: 'ServicePartitionKind',
                clientName: 'servicePartitionKind'
              },
              uberParent: 'PartitionInformation',
              className: 'PartitionInformation'
            }
          },
          endpoints: {
            required: true,
            serializedName: 'Endpoints',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ResolvedServiceEndpointElementType',
                  type: {
                    name: 'Composite',
                    className: 'ResolvedServiceEndpoint'
                  }
              }
            }
          },
          version: {
            required: true,
            serializedName: 'Version',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = ResolvedServicePartition;
