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

/**
 * Parameters supplied to the Create or Update Event Source operation for an
 * IoTHub event source.
 *
 * @extends models['EventSourceCreateOrUpdateParameters']
 */
class IoTHubEventSourceCreateOrUpdateParameters extends models['EventSourceCreateOrUpdateParameters'] {
  /**
   * Create a IoTHubEventSourceCreateOrUpdateParameters.
   * @member {string} [provisioningState] Provisioning state of the resource.
   * Possible values include: 'Accepted', 'Creating', 'Updating', 'Succeeded',
   * 'Failed', 'Deleting'
   * @member {date} [creationTime] The time the resource was created.
   * @member {string} [timestampPropertyName] The event property that will be
   * used as the event source's timestamp. If a value isn't specified for
   * timestampPropertyName, or if null or empty-string is specified, the event
   * creation time will be used.
   * @member {string} eventSourceResourceId The resource id of the event source
   * in Azure Resource Manager.
   * @member {string} iotHubName The name of the iot hub.
   * @member {string} consumerGroupName The name of the iot hub's consumer
   * group that holds the partitions from which events will be read.
   * @member {string} keyName The name of the Shared Access Policy key that
   * grants the Time Series Insights service access to the iot hub. This shared
   * access policy key must grant 'service connect' permissions to the iot hub.
   * @member {string} sharedAccessKey The value of the Shared Access Policy key
   * that grants the Time Series Insights service read access to the iot hub.
   * This property is not shown in event source responses.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of IoTHubEventSourceCreateOrUpdateParameters
   *
   * @returns {object} metadata of IoTHubEventSourceCreateOrUpdateParameters
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Microsoft.IoTHub',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'kind',
          clientName: 'kind'
        },
        uberParent: 'CreateOrUpdateTrackedResourceProperties',
        className: 'IoTHubEventSourceCreateOrUpdateParameters',
        modelProperties: {
          location: {
            required: true,
            serializedName: 'location',
            type: {
              name: 'String'
            }
          },
          tags: {
            required: false,
            serializedName: 'tags',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          kind: {
            required: true,
            serializedName: 'kind',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          provisioningState: {
            required: false,
            serializedName: 'properties.provisioningState',
            type: {
              name: 'Enum',
              allowedValues: [ 'Accepted', 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting' ]
            }
          },
          creationTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.creationTime',
            type: {
              name: 'DateTime'
            }
          },
          timestampPropertyName: {
            required: false,
            serializedName: 'properties.timestampPropertyName',
            type: {
              name: 'String'
            }
          },
          eventSourceResourceId: {
            required: true,
            serializedName: 'properties.eventSourceResourceId',
            type: {
              name: 'String'
            }
          },
          iotHubName: {
            required: true,
            serializedName: 'properties.iotHubName',
            type: {
              name: 'String'
            }
          },
          consumerGroupName: {
            required: true,
            serializedName: 'properties.consumerGroupName',
            type: {
              name: 'String'
            }
          },
          keyName: {
            required: true,
            serializedName: 'properties.keyName',
            type: {
              name: 'String'
            }
          },
          sharedAccessKey: {
            required: true,
            serializedName: 'properties.sharedAccessKey',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = IoTHubEventSourceCreateOrUpdateParameters;
