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

/**
 * The properties of the fallback route. IoT Hub uses these properties when it
 * routes messages to the fallback endpoint.
 *
 */
class FallbackRouteProperties {
  /**
   * Create a FallbackRouteProperties.
   * @member {string} [name] The name of the route. The name can only include
   * alphanumeric characters, periods, underscores, hyphens, has a maximum
   * length of 64 characters, and must be unique.
   * @member {string} [condition] The condition which is evaluated in order to
   * apply the fallback route. If the condition is not provided it will
   * evaluate to true by default. For grammar, See:
   * https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language
   * @member {array} endpointNames The list of endpoints to which the messages
   * that satisfy the condition are routed to. Currently only 1 endpoint is
   * allowed.
   * @member {boolean} isEnabled Used to specify whether the fallback route is
   * enabled.
   */
  constructor() {
  }

  /**
   * Defines the metadata of FallbackRouteProperties
   *
   * @returns {object} metadata of FallbackRouteProperties
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'FallbackRouteProperties',
      type: {
        name: 'Composite',
        className: 'FallbackRouteProperties',
        modelProperties: {
          name: {
            required: false,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          source: {
            required: true,
            isConstant: true,
            serializedName: 'source',
            defaultValue: 'DeviceMessages',
            type: {
              name: 'String'
            }
          },
          condition: {
            required: false,
            serializedName: 'condition',
            type: {
              name: 'String'
            }
          },
          endpointNames: {
            required: true,
            serializedName: 'endpointNames',
            constraints: {
              MaxItems: 1,
              MinItems: 1
            },
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          isEnabled: {
            required: true,
            serializedName: 'isEnabled',
            type: {
              name: 'Boolean'
            }
          }
        }
      }
    };
  }
}

module.exports = FallbackRouteProperties;
