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

/**
 * The workflow trigger.
 *
 * @extends models['SubResource']
 */
class WorkflowTrigger extends models['SubResource'] {
  /**
   * Create a WorkflowTrigger.
   * @property {string} [provisioningState] Gets the provisioning state.
   * Possible values include: 'NotSpecified', 'Accepted', 'Running', 'Ready',
   * 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed',
   * 'Succeeded', 'Moving', 'Updating', 'Registering', 'Registered',
   * 'Unregistering', 'Unregistered', 'Completed'
   * @property {date} [createdTime] Gets the created time.
   * @property {date} [changedTime] Gets the changed time.
   * @property {string} [state] Gets the state. Possible values include:
   * 'NotSpecified', 'Completed', 'Enabled', 'Disabled', 'Deleted', 'Suspended'
   * @property {string} [status] Gets the status. Possible values include:
   * 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped',
   * 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted',
   * 'Ignored'
   * @property {date} [lastExecutionTime] Gets the last execution time.
   * @property {date} [nextExecutionTime] Gets the next execution time.
   * @property {object} [recurrence] Gets the workflow trigger recurrence.
   * @property {string} [recurrence.frequency] The frequency. Possible values
   * include: 'NotSpecified', 'Second', 'Minute', 'Hour', 'Day', 'Week',
   * 'Month', 'Year'
   * @property {number} [recurrence.interval] The interval.
   * @property {string} [recurrence.startTime] The start time.
   * @property {string} [recurrence.endTime] The end time.
   * @property {string} [recurrence.timeZone] The time zone.
   * @property {object} [recurrence.schedule] The recurrence schedule.
   * @property {array} [recurrence.schedule.minutes] The minutes.
   * @property {array} [recurrence.schedule.hours] The hours.
   * @property {array} [recurrence.schedule.weekDays] The days of the week.
   * @property {array} [recurrence.schedule.monthDays] The month days.
   * @property {array} [recurrence.schedule.monthlyOccurrences] The monthly
   * occurrences.
   * @property {object} [workflow] Gets the reference to workflow.
   * @property {string} [workflow.id] The resource id.
   * @property {string} [workflow.name] Gets the resource name.
   * @property {string} [workflow.type] Gets the resource type.
   * @property {string} [name] Gets the workflow trigger name.
   * @property {string} [type] Gets the workflow trigger type.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of WorkflowTrigger
   *
   * @returns {object} metadata of WorkflowTrigger
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'WorkflowTrigger',
      type: {
        name: 'Composite',
        className: 'WorkflowTrigger',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          provisioningState: {
            required: false,
            readOnly: true,
            serializedName: 'properties.provisioningState',
            type: {
              name: 'String'
            }
          },
          createdTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.createdTime',
            type: {
              name: 'DateTime'
            }
          },
          changedTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.changedTime',
            type: {
              name: 'DateTime'
            }
          },
          state: {
            required: false,
            readOnly: true,
            serializedName: 'properties.state',
            type: {
              name: 'String'
            }
          },
          status: {
            required: false,
            readOnly: true,
            serializedName: 'properties.status',
            type: {
              name: 'String'
            }
          },
          lastExecutionTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.lastExecutionTime',
            type: {
              name: 'DateTime'
            }
          },
          nextExecutionTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.nextExecutionTime',
            type: {
              name: 'DateTime'
            }
          },
          recurrence: {
            required: false,
            readOnly: true,
            serializedName: 'properties.recurrence',
            type: {
              name: 'Composite',
              className: 'WorkflowTriggerRecurrence'
            }
          },
          workflow: {
            required: false,
            readOnly: true,
            serializedName: 'properties.workflow',
            type: {
              name: 'Composite',
              className: 'ResourceReference'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = WorkflowTrigger;
