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

var models = require('./index');

/**
 * @class
 * Initializes a new instance of the TaskInformation class.
 * @constructor
 * Information about a task running on a compute node.
 * @member {string} [taskUrl] The URL of the task.
 * 
 * @member {string} [jobId] The id of the job to which the task belongs.
 * 
 * @member {string} [taskId] The id of the task.
 * 
 * @member {number} [subtaskId] The id of the subtask if the task is a
 * multi-instance task.
 * 
 * @member {string} taskState The current state of the task. Possible values
 * include: 'active', 'preparing', 'running', 'completed'
 * 
 * @member {object} [executionInfo] Information about the execution of the
 * task.
 * 
 * @member {date} [executionInfo.startTime] The time at which the task started
 * running. If the task has been restarted or retried, this is the most
 * recent time at which the task started running.
 * 
 * @member {date} [executionInfo.endTime] The time at which the task
 * completed. This property is set only if the task is in the Completed state.
 * 
 * @member {number} [executionInfo.exitCode] The exit code of the task. This
 * property is set only if the task is in completed state.
 * 
 * @member {object} [executionInfo.schedulingError] Details of any error
 * encountered scheduling the task.
 * 
 * @member {string} [executionInfo.schedulingError.category] The category of
 * the task scheduling error. Possible values include: 'usererror',
 * 'servererror', 'unmapped'
 * 
 * @member {string} [executionInfo.schedulingError.code] An identifier for the
 * task scheduling error. Codes are invariant and are intended to be consumed
 * programmatically.
 * 
 * @member {string} [executionInfo.schedulingError.message] A message
 * describing the task scheduling error, intended to be suitable for display
 * in a user interface.
 * 
 * @member {array} [executionInfo.schedulingError.details] The list of
 * additional error details related to the scheduling error.
 * 
 * @member {number} [executionInfo.retryCount] The number of times the task
 * has been retried by the Batch service.
 * 
 * @member {date} [executionInfo.lastRetryTime] The most recent time at which
 * a retry of the task started running.
 * 
 * @member {number} [executionInfo.requeueCount] The number of times the task
 * has been requeued by the Batch service as the result of a user request.
 * 
 * @member {date} [executionInfo.lastRequeueTime] The most recent time at
 * which the task has been requeued by the Batch service as the result of a
 * user request.
 * 
 */
function TaskInformation() {
}

/**
 * Defines the metadata of TaskInformation
 *
 * @returns {object} metadata of TaskInformation
 *
 */
TaskInformation.prototype.mapper = function () {
  return {
    required: false,
    serializedName: 'TaskInformation',
    type: {
      name: 'Composite',
      className: 'TaskInformation',
      modelProperties: {
        taskUrl: {
          required: false,
          serializedName: 'taskUrl',
          type: {
            name: 'String'
          }
        },
        jobId: {
          required: false,
          serializedName: 'jobId',
          type: {
            name: 'String'
          }
        },
        taskId: {
          required: false,
          serializedName: 'taskId',
          type: {
            name: 'String'
          }
        },
        subtaskId: {
          required: false,
          serializedName: 'subtaskId',
          type: {
            name: 'Number'
          }
        },
        taskState: {
          required: true,
          serializedName: 'taskState',
          type: {
            name: 'Enum',
            allowedValues: [ 'active', 'preparing', 'running', 'completed' ]
          }
        },
        executionInfo: {
          required: false,
          serializedName: 'executionInfo',
          type: {
            name: 'Composite',
            className: 'TaskExecutionInformation'
          }
        }
      }
    }
  };
};

module.exports = TaskInformation;
