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

var util = require('util');

/**
 * @class
 * Initializes a new instance of the JobPreparationTask class.
 * @constructor
 * A Job Preparation task to run before any tasks of the job on any given
 * compute node.
 * @member {string} [id] A string that uniquely identifies the job preparation
 * task within the job. The id can contain any combination of alphanumeric
 * characters including hyphens and underscores and cannot contain more than
 * 64 characters.
 * 
 * @member {string} [commandLine] The command line of the Job Preparation task.
 * 
 * @member {array} [resourceFiles] A list of files that the Batch service will
 * download to the compute node before running the command line.
 * 
 * @member {array} [environmentSettings] A list of environment variable
 * settings for the Job Preparation task.
 * 
 * @member {object} [constraints] Constraints that apply to the Job
 * Preparation task.
 * 
 * @member {moment.duration} [constraints.maxWallClockTime] The maximum
 * elapsed time that the task may run, measured from the time the task
 * starts. If the task does not complete within the time limit, the Batch
 * service terminates it.
 * 
 * @member {moment.duration} [constraints.retentionTime] The minimum time to
 * retain the working directory for the task on the compute node where it
 * ran, from the time it completes execution. After this time, the Batch
 * service may delete the working directory and all its contents. The default
 * is infinite.
 * 
 * @member {number} [constraints.maxTaskRetryCount] The maximum number of
 * times the task may be retried. The Batch service retries a task if its
 * exit code is nonzero.
 * 
 * @member {boolean} [waitForSuccess] Whether the Batch service should wait
 * for the Job Preparation task to complete successfully before scheduling
 * any other tasks of the job on the compute node.
 * 
 * @member {boolean} [runElevated] Whether to run the Job Preparation task in
 * elevated mode. The default value is false.
 * 
 * @member {boolean} [rerunOnNodeRebootAfterSuccess] Whether the Batch service
 * should rerun the Job Preparation task after a compute node reboots. Note
 * that the Job Preparation task should still be written to be idempotent
 * because it can be rerun if the compute node is rebooted while Job
 * Preparation task is still running. The default value is true.
 * 
 */
function JobPreparationTask() {
}

/**
 * Defines the metadata of JobPreparationTask
 *
 * @returns {object} metadata of JobPreparationTask
 *
 */
JobPreparationTask.prototype.mapper = function () {
  return {
    required: false,
    serializedName: 'JobPreparationTask',
    type: {
      name: 'Composite',
      className: 'JobPreparationTask',
      modelProperties: {
        id: {
          required: false,
          serializedName: 'id',
          type: {
            name: 'String'
          }
        },
        commandLine: {
          required: false,
          serializedName: 'commandLine',
          type: {
            name: 'String'
          }
        },
        resourceFiles: {
          required: false,
          serializedName: 'resourceFiles',
          type: {
            name: 'Sequence',
            element: {
                required: false,
                serializedName: 'ResourceFileElementType',
                type: {
                  name: 'Composite',
                  className: 'ResourceFile'
                }
            }
          }
        },
        environmentSettings: {
          required: false,
          serializedName: 'environmentSettings',
          type: {
            name: 'Sequence',
            element: {
                required: false,
                serializedName: 'EnvironmentSettingElementType',
                type: {
                  name: 'Composite',
                  className: 'EnvironmentSetting'
                }
            }
          }
        },
        constraints: {
          required: false,
          serializedName: 'constraints',
          type: {
            name: 'Composite',
            className: 'TaskConstraints'
          }
        },
        waitForSuccess: {
          required: false,
          serializedName: 'waitForSuccess',
          type: {
            name: 'Boolean'
          }
        },
        runElevated: {
          required: false,
          serializedName: 'runElevated',
          type: {
            name: 'Boolean'
          }
        },
        rerunOnNodeRebootAfterSuccess: {
          required: false,
          serializedName: 'rerunOnNodeRebootAfterSuccess',
          type: {
            name: 'Boolean'
          }
        }
      }
    }
  };
};

module.exports = JobPreparationTask;
