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

/**
 * Referenced tumbling window trigger dependency.
 *
 * @extends models['TriggerDependencyReference']
 */
class TumblingWindowTriggerDependencyReference extends models['TriggerDependencyReference'] {
  /**
   * Create a TumblingWindowTriggerDependencyReference.
   * @member {string} [offset] Timespan applied to the start time of a tumbling
   * window when evaluating dependency.
   * @member {string} [size] The size of the window when evaluating the
   * dependency. If undefined the frequency of the tumbling window will be
   * used.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of TumblingWindowTriggerDependencyReference
   *
   * @returns {object} metadata of TumblingWindowTriggerDependencyReference
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'TumblingWindowTriggerDependencyReference',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'type',
          clientName: 'type'
        },
        uberParent: 'DependencyReference',
        className: 'TumblingWindowTriggerDependencyReference',
        modelProperties: {
          type: {
            required: true,
            serializedName: 'type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          referenceTrigger: {
            required: true,
            serializedName: 'referenceTrigger',
            defaultValue: {},
            type: {
              name: 'Composite',
              className: 'TriggerReference'
            }
          },
          offset: {
            required: false,
            serializedName: 'offset',
            constraints: {
              MaxLength: 15,
              MinLength: 8,
              Pattern: '((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9]))'
            },
            type: {
              name: 'String'
            }
          },
          size: {
            required: false,
            serializedName: 'size',
            constraints: {
              MaxLength: 15,
              MinLength: 8,
              Pattern: '((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9]))'
            },
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = TumblingWindowTriggerDependencyReference;
