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

/**
 * Describes an IoT Hub input data source that contains stream data.
 *
 * @extends models['StreamInputDataSource']
 */
class IoTHubStreamInputDataSource extends models['StreamInputDataSource'] {
  /**
   * Create a IoTHubStreamInputDataSource.
   * @member {string} [iotHubNamespace] The name or the URI of the IoT Hub.
   * Required on PUT (CreateOrReplace) requests.
   * @member {string} [sharedAccessPolicyName] The shared access policy name
   * for the IoT Hub. This policy must contain at least the Service connect
   * permission. Required on PUT (CreateOrReplace) requests.
   * @member {string} [sharedAccessPolicyKey] The shared access policy key for
   * the specified shared access policy. Required on PUT (CreateOrReplace)
   * requests.
   * @member {string} [consumerGroupName] The name of an IoT Hub Consumer Group
   * that should be used to read events from the IoT Hub. If not specified, the
   * input uses the Iot Hub’s default consumer group.
   * @member {string} [endpoint] The IoT Hub endpoint to connect to (ie.
   * messages/events, messages/operationsMonitoringEvents, etc.).
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of IoTHubStreamInputDataSource
   *
   * @returns {object} metadata of IoTHubStreamInputDataSource
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Microsoft.Devices/IotHubs',
      type: {
        name: 'Composite',
        className: 'IoTHubStreamInputDataSource',
        modelProperties: {
          type: {
            required: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          iotHubNamespace: {
            required: false,
            serializedName: 'properties.iotHubNamespace',
            type: {
              name: 'String'
            }
          },
          sharedAccessPolicyName: {
            required: false,
            serializedName: 'properties.sharedAccessPolicyName',
            type: {
              name: 'String'
            }
          },
          sharedAccessPolicyKey: {
            required: false,
            serializedName: 'properties.sharedAccessPolicyKey',
            type: {
              name: 'String'
            }
          },
          consumerGroupName: {
            required: false,
            serializedName: 'properties.consumerGroupName',
            type: {
              name: 'String'
            }
          },
          endpoint: {
            required: false,
            serializedName: 'properties.endpoint',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = IoTHubStreamInputDataSource;
