/*
 * 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 JobAddParameter class.
 * @constructor
 * An Azure Batch job to add.
 * @member {string} id A string that uniquely identifies the job within the
 * account. The id can contain any combination of alphanumeric characters
 * including hyphens and underscores, and cannot contain more than 64
 * characters. It is common to use a GUID for the id.
 * 
 * @member {string} [displayName] The display name for the job.
 * 
 * @member {number} [priority] The priority of the job. Priority values can
 * range from -1000 to 1000, with -1000 being the lowest priority and 1000
 * being the highest priority. The default value is 0.
 * 
 * @member {object} [constraints] The execution constraints for the job.
 * 
 * @member {moment.duration} [constraints.maxWallClockTime] The maximum
 * elapsed time that the job may run, measured from the time the job starts.
 * If the job does not complete within the time limit, the Batch service
 * terminates it and any tasks that are still running.
 * 
 * @member {number} [constraints.maxTaskRetryCount] The maximum number of
 * times each task may be retried. The Batch service retries a task if its
 * exit code is nonzero.
 * 
 * @member {object} [jobManagerTask] Details of a Job Manager task to be
 * launched when the job is started.
 * 
 * @member {string} [jobManagerTask.id] A string that uniquely identifies the
 * Job Manager task. A GUID is recommended.
 * 
 * @member {string} [jobManagerTask.displayName] The display name of the Job
 * Manager task.
 * 
 * @member {string} [jobManagerTask.commandLine] The command line of the Job
 * Manager task.
 * 
 * @member {array} [jobManagerTask.resourceFiles] A list of files that the
 * Batch service will download to the compute node before running the command
 * line.
 * 
 * @member {array} [jobManagerTask.environmentSettings] A list of environment
 * variable settings for the Job Manager task.
 * 
 * @member {object} [jobManagerTask.constraints] Constraints that apply to the
 * Job Manager task.
 * 
 * @member {moment.duration} [jobManagerTask.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} [jobManagerTask.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} [jobManagerTask.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} [jobManagerTask.killJobOnCompletion] Whether completion
 * of the Job Manager task signifies completion of the entire job.
 * 
 * @member {boolean} [jobManagerTask.runElevated] Whether to run the Job
 * Manager task in elevated mode. The default value is false.
 * 
 * @member {boolean} [jobManagerTask.runExclusive] Whether the Job Manager
 * task requires exclusive use of the compute node where it runs. If true, no
 * other tasks will run on the same compute node for as long as the Job
 * Manager is running. If false, other tasks can run simultaneously with the
 * Job Manager on a compute node. (The Job Manager task counts normally
 * against the node’s concurrent task limit, so this is only relevant if the
 * node allows multiple concurrent tasks.)
 * 
 * @member {object} [jobPreparationTask] The Job Preparation task.
 * 
 * @member {string} [jobPreparationTask.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} [jobPreparationTask.commandLine] The command line of the
 * Job Preparation task.
 * 
 * @member {array} [jobPreparationTask.resourceFiles] A list of files that the
 * Batch service will download to the compute node before running the command
 * line.
 * 
 * @member {array} [jobPreparationTask.environmentSettings] A list of
 * environment variable settings for the Job Preparation task.
 * 
 * @member {object} [jobPreparationTask.constraints] Constraints that apply to
 * the Job Preparation task.
 * 
 * @member {moment.duration} [jobPreparationTask.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} [jobPreparationTask.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} [jobPreparationTask.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} [jobPreparationTask.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} [jobPreparationTask.runElevated] Whether to run the Job
 * Preparation task in elevated mode. The default value is false.
 * 
 * @member {boolean} [jobPreparationTask.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.
 * 
 * @member {object} [jobReleaseTask] The Job Release task.
 * 
 * @member {string} [jobReleaseTask.id] A string that uniquely identifies the
 * Job Release 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} [jobReleaseTask.commandLine] The command line of the Job
 * Release task.
 * 
 * @member {array} [jobReleaseTask.resourceFiles] A list of files that the
 * Batch service will download to the compute node before running the command
 * line.
 * 
 * @member {array} [jobReleaseTask.environmentSettings] A list of environment
 * variable settings for the Job Release task.
 * 
 * @member {moment.duration} [jobReleaseTask.maxWallClockTime] The maximum
 * elapsed time that the Job Release task may run on a given compute node,
 * measured from the time the task starts. If the task does not complete
 * within the time limit, the Batch service terminates it. The default value
 * is 15 minutes.
 * 
 * @member {moment.duration} [jobReleaseTask.retentionTime] The minimum time
 * to retain the working directory for the Job Release task on the compute
 * node. After this time, the Batch service may delete the working directory
 * and all its contents. The default is infinite.
 * 
 * @member {boolean} [jobReleaseTask.runElevated] Whether to run the Job
 * Release task in elevated mode. The default value is false.
 * 
 * @member {array} [commonEnvironmentSettings] The list of common environment
 * variable settings. These environment variables are set for all tasks in
 * the job (including the Job Manager, Job Preparation and Job Release tasks).
 * 
 * @member {object} poolInfo The pool on which the Batch service runs the
 * job’s tasks.
 * 
 * @member {string} [poolInfo.poolId] The id of an existing pool. All the
 * tasks of the job will run on the specified pool. You must specify either
 * PoolId or AutoPoolSpecification, but not both.
 * 
 * @member {object} [poolInfo.autoPoolSpecification] Characteristics for a
 * temporary 'auto pool'. The Batch service will create this auto pool and
 * run all of the tasks of the job on it, and will delete the pool once the
 * job has completed. You must specify either PoolId or
 * AutoPoolSpecification, but not both.
 * 
 * @member {string} [poolInfo.autoPoolSpecification.autoPoolIdPrefix] A prefix
 * to be added to the unique identifier when a pool is automatically created.
 * The prefix can be up to 20 characters long.
 * 
 * @member {string} [poolInfo.autoPoolSpecification.poolLifetimeOption] The
 * minimum lifetime of created auto pools, and how multiple jobs on a
 * schedule are assigned to pools. Possible values include: 'jobschedule',
 * 'job', 'unmapped'
 * 
 * @member {boolean} [poolInfo.autoPoolSpecification.keepAlive] Whether to
 * keep an auto pool alive after its lifetime expires.
 * 
 * @member {object} [poolInfo.autoPoolSpecification.pool] The pool
 * specification for the auto pool.
 * 
 * @member {string} [poolInfo.autoPoolSpecification.pool.displayName] The
 * display name for the pool.
 * 
 * @member {string} [poolInfo.autoPoolSpecification.pool.vmSize] The size of
 * the virtual machines in the pool. All virtual machines in a pool are the
 * same size.
 * 
 * @member {object}
 * [poolInfo.autoPoolSpecification.pool.cloudServiceConfiguration] The cloud
 * service configuration for the pool. This property and
 * VirtualMachineConfiguration are mutually exclusive and one of the
 * properties must be specified.
 * 
 * @member {string}
 * [poolInfo.autoPoolSpecification.pool.cloudServiceConfiguration.osFamily]
 * The Azure Guest OS family to be installed on the virtual machines in the
 * pool.
 * 
 * @member {string}
 * [poolInfo.autoPoolSpecification.pool.cloudServiceConfiguration.targetOSVersion]
 * The Azure Guest OS version to be installed on the virtual machines in the
 * pool. The default value is * which specifies the latest operating system
 * version for the specified OS family.
 * 
 * @member {string}
 * [poolInfo.autoPoolSpecification.pool.cloudServiceConfiguration.currentOSVersion]
 * The Azure Guest OS Version currently installed on the virtual machines in
 * the pool. This may differ from TargetOSVersion if the pool state is
 * Upgrading.
 * 
 * @member {object}
 * [poolInfo.autoPoolSpecification.pool.virtualMachineConfiguration] The
 * virtual machine configuration for the pool. This property and
 * CloudServiceConfiguration are mutually exclusive and one of the properties
 * must be specified.
 * 
 * @member {object}
 * [poolInfo.autoPoolSpecification.pool.virtualMachineConfiguration.imageReference]
 * A reference to the Azure Virtual Machines Marketplace image to use.
 * 
 * @member {string}
 * [poolInfo.autoPoolSpecification.pool.virtualMachineConfiguration.imageReference.publisher]
 * The publisher of the Azure Virtual Machines Marketplace image. For
 * example, Canonical or MicrosoftWindowsServer.
 * 
 * @member {string}
 * [poolInfo.autoPoolSpecification.pool.virtualMachineConfiguration.imageReference.offer]
 * The offer type of the Azure Virtual Machines Marketplace image. For
 * example, UbuntuServer or WindowsServer.
 * 
 * @member {string}
 * [poolInfo.autoPoolSpecification.pool.virtualMachineConfiguration.imageReference.sku]
 * The SKU of the Azure Virtual Machines Marketplace image. For example,
 * 14.04.0-LTS or 2012-R2-Datacenter.
 * 
 * @member {string}
 * [poolInfo.autoPoolSpecification.pool.virtualMachineConfiguration.imageReference.version]
 * The version of the Azure Virtual Machines Marketplace image. A value of
 * 'latest' can be specified to select the latest version of an image. If
 * omitted, the default is 'latest'.
 * 
 * @member {string}
 * [poolInfo.autoPoolSpecification.pool.virtualMachineConfiguration.nodeAgentSKUId]
 * The SKU of Batch Node Agent to be provisioned on the compute node. The
 * Batch node agent is a program that runs on each node in the pool, and
 * provides the command-and-control interface between the node and the Batch
 * service. There are different implementations of the node agent, known as
 * SKUs, for different operating systems.
 * 
 * @member {object}
 * [poolInfo.autoPoolSpecification.pool.virtualMachineConfiguration.windowsConfiguration]
 * Windows operating system settings on the virtual machine. This property
 * must not be specified if the ImageReference property specifies a Linux OS
 * image.
 * 
 * @member {boolean}
 * [poolInfo.autoPoolSpecification.pool.virtualMachineConfiguration.windowsConfiguration.enableAutomaticUpdates]
 * Whether automatic updates are enabled on the virtual machine. If omitted,
 * the default value is true.
 * 
 * @member {number} [poolInfo.autoPoolSpecification.pool.maxTasksPerNode] The
 * maximum number of tasks that can run concurrently on a single compute node
 * in the pool.
 * 
 * @member {object} [poolInfo.autoPoolSpecification.pool.taskSchedulingPolicy]
 * How tasks are distributed among compute nodes in the pool.
 * 
 * @member {string}
 * [poolInfo.autoPoolSpecification.pool.taskSchedulingPolicy.nodeFillType]
 * How tasks should be distributed across compute nodes. Possible values
 * include: 'spread', 'pack', 'unmapped'
 * 
 * @member {moment.duration}
 * [poolInfo.autoPoolSpecification.pool.resizeTimeout] The timeout for
 * allocation of compute nodes to the pool.
 * 
 * @member {number} [poolInfo.autoPoolSpecification.pool.targetDedicated] The
 * desired number of compute nodes in the pool.
 * 
 * @member {boolean} [poolInfo.autoPoolSpecification.pool.enableAutoScale]
 * Whether the pool size should automatically adjust over time.
 * 
 * @member {string} [poolInfo.autoPoolSpecification.pool.autoScaleFormula] The
 * formula for the desired number of compute nodes in the pool.
 * 
 * @member {moment.duration}
 * [poolInfo.autoPoolSpecification.pool.autoScaleEvaluationInterval] A time
 * interval for the desired AutoScale evaluation period in the pool.
 * 
 * @member {boolean}
 * [poolInfo.autoPoolSpecification.pool.enableInterNodeCommunication] Whether
 * the pool permits direct communication between nodes.
 * 
 * @member {object} [poolInfo.autoPoolSpecification.pool.startTask] A task to
 * run on each compute node as it joins the pool. The task runs when the node
 * is added to the pool or when the node is restarted.
 * 
 * @member {string}
 * [poolInfo.autoPoolSpecification.pool.startTask.commandLine] The command
 * line of the start task.
 * 
 * @member {array}
 * [poolInfo.autoPoolSpecification.pool.startTask.resourceFiles] A list of
 * files that the Batch service will download to the compute node before
 * running the command line.
 * 
 * @member {array}
 * [poolInfo.autoPoolSpecification.pool.startTask.environmentSettings] A list
 * of environment variable settings for the start task.
 * 
 * @member {boolean}
 * [poolInfo.autoPoolSpecification.pool.startTask.runElevated] Whether to run
 * the start task in elevated mode. The default value is false.
 * 
 * @member {number}
 * [poolInfo.autoPoolSpecification.pool.startTask.maxTaskRetryCount] The
 * maximum number of times the task may be retried.
 * 
 * @member {boolean}
 * [poolInfo.autoPoolSpecification.pool.startTask.waitForSuccess] Whether the
 * Batch service should wait for the start task to complete successfully
 * (that is, to exit with exit code 0) before scheduling any tasks on the
 * compute node.
 * 
 * @member {array} [poolInfo.autoPoolSpecification.pool.certificateReferences]
 * A list of certificates to be installed on each compute node in the pool.
 * 
 * @member {array}
 * [poolInfo.autoPoolSpecification.pool.applicationPackageReferences] The
 * list of application packages to be installed on each compute node in the
 * pool.
 * 
 * @member {array} [poolInfo.autoPoolSpecification.pool.metadata] A list of
 * name-value pairs associated with the pool as metadata.
 * 
 * @member {array} [metadata] A list of name-value pairs associated with the
 * job as metadata.
 * 
 * @member {boolean} [usesTaskDependencies] The flag that determines if this
 * job will use tasks with dependencies.
 * 
 */
function JobAddParameter() {
}

/**
 * Defines the metadata of JobAddParameter
 *
 * @returns {object} metadata of JobAddParameter
 *
 */
JobAddParameter.prototype.mapper = function () {
  return {
    required: false,
    serializedName: 'JobAddParameter',
    type: {
      name: 'Composite',
      className: 'JobAddParameter',
      modelProperties: {
        id: {
          required: true,
          serializedName: 'id',
          type: {
            name: 'String'
          }
        },
        displayName: {
          required: false,
          serializedName: 'displayName',
          type: {
            name: 'String'
          }
        },
        priority: {
          required: false,
          serializedName: 'priority',
          type: {
            name: 'Number'
          }
        },
        constraints: {
          required: false,
          serializedName: 'constraints',
          type: {
            name: 'Composite',
            className: 'JobConstraints'
          }
        },
        jobManagerTask: {
          required: false,
          serializedName: 'jobManagerTask',
          type: {
            name: 'Composite',
            className: 'JobManagerTask'
          }
        },
        jobPreparationTask: {
          required: false,
          serializedName: 'jobPreparationTask',
          type: {
            name: 'Composite',
            className: 'JobPreparationTask'
          }
        },
        jobReleaseTask: {
          required: false,
          serializedName: 'jobReleaseTask',
          type: {
            name: 'Composite',
            className: 'JobReleaseTask'
          }
        },
        commonEnvironmentSettings: {
          required: false,
          serializedName: 'commonEnvironmentSettings',
          type: {
            name: 'Sequence',
            element: {
                required: false,
                serializedName: 'EnvironmentSettingElementType',
                type: {
                  name: 'Composite',
                  className: 'EnvironmentSetting'
                }
            }
          }
        },
        poolInfo: {
          required: true,
          serializedName: 'poolInfo',
          type: {
            name: 'Composite',
            className: 'PoolInformation'
          }
        },
        metadata: {
          required: false,
          serializedName: 'metadata',
          type: {
            name: 'Sequence',
            element: {
                required: false,
                serializedName: 'MetadataItemElementType',
                type: {
                  name: 'Composite',
                  className: 'MetadataItem'
                }
            }
          }
        },
        usesTaskDependencies: {
          required: false,
          serializedName: 'usesTaskDependencies',
          type: {
            name: 'Boolean'
          }
        }
      }
    }
  };
};

module.exports = JobAddParameter;
