/*
 * 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 creates pipeline runs periodically, on schedule.
 *
 * @extends models['MultiplePipelineTrigger']
 */
class ScheduleTrigger extends models['MultiplePipelineTrigger'] {
  /**
   * Create a ScheduleTrigger.
   * @member {object} recurrence Recurrence schedule configuration.
   * @member {string} [recurrence.frequency] The frequency. Possible values
   * include: 'NotSpecified', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year'
   * @member {number} [recurrence.interval] The interval.
   * @member {date} [recurrence.startTime] The start time.
   * @member {date} [recurrence.endTime] The end time.
   * @member {string} [recurrence.timeZone] The time zone.
   * @member {object} [recurrence.schedule] The recurrence schedule.
   * @member {array} [recurrence.schedule.minutes] The minutes.
   * @member {array} [recurrence.schedule.hours] The hours.
   * @member {array} [recurrence.schedule.weekDays] The days of the week.
   * @member {array} [recurrence.schedule.monthDays] The month days.
   * @member {array} [recurrence.schedule.monthlyOccurrences] The monthly
   * occurrences.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ScheduleTrigger
   *
   * @returns {object} metadata of ScheduleTrigger
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ScheduleTrigger',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'type',
          clientName: 'type'
        },
        uberParent: 'Trigger',
        className: 'ScheduleTrigger',
        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'
            }
          },
          pipelines: {
            required: false,
            serializedName: 'pipelines',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'TriggerPipelineReferenceElementType',
                  type: {
                    name: 'Composite',
                    className: 'TriggerPipelineReference'
                  }
              }
            }
          },
          recurrence: {
            required: true,
            serializedName: 'typeProperties.recurrence',
            type: {
              name: 'Composite',
              additionalProperties: {
                type: {
                  name: 'Dictionary',
                  value: {
                      required: false,
                      serializedName: 'ObjectElementType',
                      type: {
                        name: 'Object'
                      }
                  }
                }
              },
              className: 'ScheduleTriggerRecurrence'
            }
          }
        }
      }
    };
  }
}

module.exports = ScheduleTrigger;
