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

/**
 * Trigger that schedules pipeline reruns for all fixed time interval windows
 * from a requested start time to requested end time.
 *
 * @extends models['Trigger']
 */
class RerunTumblingWindowTrigger extends models['Trigger'] {
  /**
   * Create a RerunTumblingWindowTrigger.
   * @member {object} [parentTrigger] The parent trigger reference.
   * @member {date} requestedStartTime The start time for the time period for
   * which restatement is initiated. Only UTC time is currently supported.
   * @member {date} requestedEndTime The end time for the time period for which
   * restatement is initiated. Only UTC time is currently supported.
   * @member {number} maxConcurrency The max number of parallel time windows
   * (ready for execution) for which a rerun is triggered.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of RerunTumblingWindowTrigger
   *
   * @returns {object} metadata of RerunTumblingWindowTrigger
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'RerunTumblingWindowTrigger',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'type',
          clientName: 'type'
        },
        uberParent: 'Trigger',
        className: 'RerunTumblingWindowTrigger',
        modelProperties: {
          description: {
            required: false,
            serializedName: 'description',
            type: {
              name: 'String'
            }
          },
          runtimeState: {
            required: false,
            readOnly: true,
            serializedName: 'runtimeState',
            type: {
              name: 'String'
            }
          },
          type: {
            required: true,
            serializedName: 'type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          parentTrigger: {
            required: false,
            serializedName: 'typeProperties.parentTrigger',
            type: {
              name: 'Object'
            }
          },
          requestedStartTime: {
            required: true,
            serializedName: 'typeProperties.requestedStartTime',
            type: {
              name: 'DateTime'
            }
          },
          requestedEndTime: {
            required: true,
            serializedName: 'typeProperties.requestedEndTime',
            type: {
              name: 'DateTime'
            }
          },
          maxConcurrency: {
            required: true,
            serializedName: 'typeProperties.maxConcurrency',
            constraints: {
              InclusiveMaximum: 50,
              InclusiveMinimum: 1
            },
            type: {
              name: 'Number'
            }
          }
        }
      }
    };
  }
}

module.exports = RerunTumblingWindowTrigger;
