/*
 * 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 condition that results in the Log Search rule.
 *
 */
class TriggerCondition {
  /**
   * Create a TriggerCondition.
   * @property {string} thresholdOperator Evaluation operation for rule -
   * 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan',
   * 'LessThan', 'Equal'
   * @property {number} threshold Result or count threshold based on which rule
   * should be triggered.
   * @property {object} [metricTrigger] Trigger condition for metric query rule
   * @property {string} [metricTrigger.thresholdOperator] Evaluation operation
   * for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values
   * include: 'GreaterThan', 'LessThan', 'Equal'
   * @property {number} [metricTrigger.threshold] The threshold of the metric
   * trigger.
   * @property {string} [metricTrigger.metricTriggerType] Metric Trigger Type -
   * 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total'
   * @property {string} [metricTrigger.metricColumn] Evaluation of metric on a
   * particular column
   */
  constructor() {
  }

  /**
   * Defines the metadata of TriggerCondition
   *
   * @returns {object} metadata of TriggerCondition
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'TriggerCondition',
      type: {
        name: 'Composite',
        className: 'TriggerCondition',
        modelProperties: {
          thresholdOperator: {
            required: true,
            serializedName: 'thresholdOperator',
            type: {
              name: 'String'
            }
          },
          threshold: {
            required: true,
            serializedName: 'threshold',
            type: {
              name: 'Number'
            }
          },
          metricTrigger: {
            required: false,
            serializedName: 'metricTrigger',
            type: {
              name: 'Composite',
              className: 'LogMetricTrigger'
            }
          }
        }
      }
    };
  }
}

module.exports = TriggerCondition;
