/*
 * 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 run.
 *
 * @extends models['SubResource']
 */
class WorkflowRun extends models['SubResource'] {
  /**
   * Create a WorkflowRun.
   * @property {date} [waitEndTime] Gets the wait end time.
   * @property {date} [startTime] Gets the start time.
   * @property {date} [endTime] Gets the end time.
   * @property {string} [status] Gets the status. Possible values include:
   * 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded', 'Skipped',
   * 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut', 'Aborted',
   * 'Ignored'
   * @property {string} [code] Gets the code.
   * @property {object} [error] Gets the error.
   * @property {string} [correlationId] Gets the correlation id.
   * @property {object} [correlation] The run correlation.
   * @property {string} [correlation.clientTrackingId] The client tracking id.
   * @property {object} [workflow] Gets the reference to workflow version.
   * @property {string} [workflow.id] The resource id.
   * @property {string} [workflow.name] Gets the resource name.
   * @property {string} [workflow.type] Gets the resource type.
   * @property {object} [trigger] Gets the fired trigger.
   * @property {string} [trigger.name] Gets the name.
   * @property {object} [trigger.inputs] Gets the inputs.
   * @property {object} [trigger.inputsLink] Gets the link to inputs.
   * @property {string} [trigger.inputsLink.uri] The content link URI.
   * @property {string} [trigger.inputsLink.contentVersion] The content
   * version.
   * @property {number} [trigger.inputsLink.contentSize] The content size.
   * @property {object} [trigger.inputsLink.contentHash] The content hash.
   * @property {string} [trigger.inputsLink.contentHash.algorithm] The
   * algorithm of the content hash.
   * @property {string} [trigger.inputsLink.contentHash.value] The value of the
   * content hash.
   * @property {object} [trigger.inputsLink.metadata] The metadata.
   * @property {object} [trigger.outputs] Gets the outputs.
   * @property {object} [trigger.outputsLink] Gets the link to outputs.
   * @property {string} [trigger.outputsLink.uri] The content link URI.
   * @property {string} [trigger.outputsLink.contentVersion] The content
   * version.
   * @property {number} [trigger.outputsLink.contentSize] The content size.
   * @property {object} [trigger.outputsLink.contentHash] The content hash.
   * @property {string} [trigger.outputsLink.contentHash.algorithm] The
   * algorithm of the content hash.
   * @property {string} [trigger.outputsLink.contentHash.value] The value of
   * the content hash.
   * @property {object} [trigger.outputsLink.metadata] The metadata.
   * @property {date} [trigger.scheduledTime] Gets the scheduled time.
   * @property {date} [trigger.startTime] Gets the start time.
   * @property {date} [trigger.endTime] Gets the end time.
   * @property {string} [trigger.trackingId] Gets the tracking id.
   * @property {object} [trigger.correlation] The run correlation.
   * @property {string} [trigger.correlation.clientTrackingId] The client
   * tracking id.
   * @property {string} [trigger.code] Gets the code.
   * @property {string} [trigger.status] Gets the status. Possible values
   * include: 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded',
   * 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut',
   * 'Aborted', 'Ignored'
   * @property {object} [trigger.error] Gets the error.
   * @property {object} [trigger.trackedProperties] Gets the tracked
   * properties.
   * @property {object} [outputs] Gets the outputs.
   * @property {object} [response] Gets the response of the flow run.
   * @property {string} [response.name] Gets the name.
   * @property {object} [response.inputs] Gets the inputs.
   * @property {object} [response.inputsLink] Gets the link to inputs.
   * @property {string} [response.inputsLink.uri] The content link URI.
   * @property {string} [response.inputsLink.contentVersion] The content
   * version.
   * @property {number} [response.inputsLink.contentSize] The content size.
   * @property {object} [response.inputsLink.contentHash] The content hash.
   * @property {string} [response.inputsLink.contentHash.algorithm] The
   * algorithm of the content hash.
   * @property {string} [response.inputsLink.contentHash.value] The value of
   * the content hash.
   * @property {object} [response.inputsLink.metadata] The metadata.
   * @property {object} [response.outputs] Gets the outputs.
   * @property {object} [response.outputsLink] Gets the link to outputs.
   * @property {string} [response.outputsLink.uri] The content link URI.
   * @property {string} [response.outputsLink.contentVersion] The content
   * version.
   * @property {number} [response.outputsLink.contentSize] The content size.
   * @property {object} [response.outputsLink.contentHash] The content hash.
   * @property {string} [response.outputsLink.contentHash.algorithm] The
   * algorithm of the content hash.
   * @property {string} [response.outputsLink.contentHash.value] The value of
   * the content hash.
   * @property {object} [response.outputsLink.metadata] The metadata.
   * @property {date} [response.scheduledTime] Gets the scheduled time.
   * @property {date} [response.startTime] Gets the start time.
   * @property {date} [response.endTime] Gets the end time.
   * @property {string} [response.trackingId] Gets the tracking id.
   * @property {object} [response.correlation] The run correlation.
   * @property {string} [response.correlation.clientTrackingId] The client
   * tracking id.
   * @property {string} [response.code] Gets the code.
   * @property {string} [response.status] Gets the status. Possible values
   * include: 'NotSpecified', 'Paused', 'Running', 'Waiting', 'Succeeded',
   * 'Skipped', 'Suspended', 'Cancelled', 'Failed', 'Faulted', 'TimedOut',
   * 'Aborted', 'Ignored'
   * @property {object} [response.error] Gets the error.
   * @property {object} [response.trackedProperties] Gets the tracked
   * properties.
   * @property {string} [name] Gets the workflow run name.
   * @property {string} [type] Gets the workflow run type.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of WorkflowRun
   *
   * @returns {object} metadata of WorkflowRun
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'WorkflowRun',
      type: {
        name: 'Composite',
        className: 'WorkflowRun',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          waitEndTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.waitEndTime',
            type: {
              name: 'DateTime'
            }
          },
          startTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.startTime',
            type: {
              name: 'DateTime'
            }
          },
          endTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.endTime',
            type: {
              name: 'DateTime'
            }
          },
          status: {
            required: false,
            readOnly: true,
            serializedName: 'properties.status',
            type: {
              name: 'String'
            }
          },
          code: {
            required: false,
            readOnly: true,
            serializedName: 'properties.code',
            type: {
              name: 'String'
            }
          },
          error: {
            required: false,
            readOnly: true,
            serializedName: 'properties.error',
            type: {
              name: 'Object'
            }
          },
          correlationId: {
            required: false,
            readOnly: true,
            serializedName: 'properties.correlationId',
            type: {
              name: 'String'
            }
          },
          correlation: {
            required: false,
            serializedName: 'properties.correlation',
            type: {
              name: 'Composite',
              className: 'Correlation'
            }
          },
          workflow: {
            required: false,
            readOnly: true,
            serializedName: 'properties.workflow',
            type: {
              name: 'Composite',
              className: 'ResourceReference'
            }
          },
          trigger: {
            required: false,
            readOnly: true,
            serializedName: 'properties.trigger',
            type: {
              name: 'Composite',
              className: 'WorkflowRunTrigger'
            }
          },
          outputs: {
            required: false,
            readOnly: true,
            serializedName: 'properties.outputs',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'WorkflowOutputParameterElementType',
                  type: {
                    name: 'Composite',
                    className: 'WorkflowOutputParameter'
                  }
              }
            }
          },
          response: {
            required: false,
            readOnly: true,
            serializedName: 'properties.response',
            type: {
              name: 'Composite',
              className: 'WorkflowRunTrigger'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = WorkflowRun;
