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

/**
 * Description of Rule Resource.
 *
 * @extends models['Resource']
 */
class Rule extends models['Resource'] {
  /**
   * Create a Rule.
   * @property {object} [action] Represents the filter actions which are
   * allowed for the transformation of a message that have been matched by a
   * filter expression.
   * @property {string} [action.sqlExpression] SQL expression. e.g.
   * MyProperty='ABC'
   * @property {number} [action.compatibilityLevel] This property is reserved
   * for future use. An integer value showing the compatibility level,
   * currently hard-coded to 20.
   * @property {boolean} [action.requiresPreprocessing] Value that indicates
   * whether the rule action requires preprocessing.
   * @property {string} [filterType] Filter type that is evaluated against a
   * BrokeredMessage. Possible values include: 'SqlFilter', 'CorrelationFilter'
   * @property {object} [sqlFilter] Properties of sqlFilter
   * @property {string} [sqlFilter.sqlExpression] The SQL expression. e.g.
   * MyProperty='ABC'
   * @property {number} [sqlFilter.compatibilityLevel] This property is
   * reserved for future use. An integer value showing the compatibility level,
   * currently hard-coded to 20.
   * @property {boolean} [sqlFilter.requiresPreprocessing] Value that indicates
   * whether the rule action requires preprocessing.
   * @property {object} [correlationFilter] Properties of correlationFilter
   * @property {object} [correlationFilter.properties] dictionary object for
   * custom filters
   * @property {string} [correlationFilter.correlationId] Identifier of the
   * correlation.
   * @property {string} [correlationFilter.messageId] Identifier of the
   * message.
   * @property {string} [correlationFilter.to] Address to send to.
   * @property {string} [correlationFilter.replyTo] Address of the queue to
   * reply to.
   * @property {string} [correlationFilter.label] Application specific label.
   * @property {string} [correlationFilter.sessionId] Session identifier.
   * @property {string} [correlationFilter.replyToSessionId] Session identifier
   * to reply to.
   * @property {string} [correlationFilter.contentType] Content type of the
   * message.
   * @property {boolean} [correlationFilter.requiresPreprocessing] Value that
   * indicates whether the rule action requires preprocessing.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of Rule
   *
   * @returns {object} metadata of Rule
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Rule',
      type: {
        name: 'Composite',
        className: 'Rule',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          action: {
            required: false,
            serializedName: 'properties.action',
            type: {
              name: 'Composite',
              className: 'Action'
            }
          },
          filterType: {
            required: false,
            serializedName: 'properties.filterType',
            type: {
              name: 'Enum',
              allowedValues: [ 'SqlFilter', 'CorrelationFilter' ]
            }
          },
          sqlFilter: {
            required: false,
            serializedName: 'properties.sqlFilter',
            type: {
              name: 'Composite',
              className: 'SqlFilter'
            }
          },
          correlationFilter: {
            required: false,
            serializedName: 'properties.correlationFilter',
            type: {
              name: 'Composite',
              className: 'CorrelationFilter'
            }
          }
        }
      }
    };
  }
}

module.exports = Rule;
