/*
 * 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 SubtaskInformation class.
 * @constructor
 * Information about an Azure Batch subtask.
 * @member {number} [id] The id of the subtask.
 * 
 * @member {object} [nodeInfo] Information about the compute node on which the
 * subtask ran.
 * 
 * @member {string} [nodeInfo.affinityId] An identifier for the compute node
 * on which the task ran, which can be passed when adding a task to request
 * that the task be scheduled close to this compute node.
 * 
 * @member {string} [nodeInfo.nodeUrl] The URL of the node on which the task
 * ran.
 * 
 * @member {string} [nodeInfo.poolId] The id of the pool on which the task ran.
 * 
 * @member {string} [nodeInfo.nodeId] The id of the node on which the task ran.
 * 
 * @member {string} [nodeInfo.taskRootDirectory] The root directory of the
 * task on the compute node.
 * 
 * @member {string} [nodeInfo.taskRootDirectoryUrl] The URL to the root
 * directory of the task on the compute node.
 * 
 * @member {date} [startTime] The time at which the subtask started running.
 * If the subtask has been restarted or retried, this is the most recent time
 * at which the subtask started running.
 * 
 * @member {date} [endTime] The time at which the subtask completed. This
 * property is set only if the subtask is in the Completed state.
 * 
 * @member {number} [exitCode] The exit code of the subtask. This property is
 * set only if the subtask is in the Completed state.
 * 
 * @member {object} [schedulingError] Details of any error encountered
 * scheduling the subtask.
 * 
 * @member {string} [schedulingError.category] The category of the task
 * scheduling error. Possible values include: 'usererror', 'servererror',
 * 'unmapped'
 * 
 * @member {string} [schedulingError.code] An identifier for the task
 * scheduling error. Codes are invariant and are intended to be consumed
 * programmatically.
 * 
 * @member {string} [schedulingError.message] A message describing the task
 * scheduling error, intended to be suitable for display in a user interface.
 * 
 * @member {array} [schedulingError.details] The list of additional error
 * details related to the scheduling error.
 * 
 * @member {string} [state] The current state of the subtask. Possible values
 * include: 'active', 'preparing', 'running', 'completed'
 * 
 * @member {date} [stateTransitionTime] The time at which the subtask entered
 * its current state.
 * 
 * @member {string} [previousState] The previous state of the subtask. This
 * property is not set if the subtask is in its initial Active state.
 * Possible values include: 'active', 'preparing', 'running', 'completed'
 * 
 * @member {date} [previousStateTransitionTime] The time at which the subtask
 * entered its previous state. This property is not set if the subtask is in
 * its initial Active state.
 * 
 */
function SubtaskInformation() {
}

/**
 * Defines the metadata of SubtaskInformation
 *
 * @returns {object} metadata of SubtaskInformation
 *
 */
SubtaskInformation.prototype.mapper = function () {
  return {
    required: false,
    serializedName: 'SubtaskInformation',
    type: {
      name: 'Composite',
      className: 'SubtaskInformation',
      modelProperties: {
        id: {
          required: false,
          serializedName: 'id',
          type: {
            name: 'Number'
          }
        },
        nodeInfo: {
          required: false,
          serializedName: 'nodeInfo',
          type: {
            name: 'Composite',
            className: 'ComputeNodeInformation'
          }
        },
        startTime: {
          required: false,
          serializedName: 'startTime',
          type: {
            name: 'DateTime'
          }
        },
        endTime: {
          required: false,
          serializedName: 'endTime',
          type: {
            name: 'DateTime'
          }
        },
        exitCode: {
          required: false,
          serializedName: 'exitCode',
          type: {
            name: 'Number'
          }
        },
        schedulingError: {
          required: false,
          serializedName: 'schedulingError',
          type: {
            name: 'Composite',
            className: 'TaskSchedulingError'
          }
        },
        state: {
          required: false,
          serializedName: 'state',
          type: {
            name: 'Enum',
            allowedValues: [ 'active', 'preparing', 'running', 'completed' ]
          }
        },
        stateTransitionTime: {
          required: false,
          serializedName: 'stateTransitionTime',
          type: {
            name: 'DateTime'
          }
        },
        previousState: {
          required: false,
          serializedName: 'previousState',
          type: {
            name: 'Enum',
            allowedValues: [ 'active', 'preparing', 'running', 'completed' ]
          }
        },
        previousStateTransitionTime: {
          required: false,
          serializedName: 'previousStateTransitionTime',
          type: {
            name: 'DateTime'
          }
        }
      }
    }
  };
};

module.exports = SubtaskInformation;
