/**
 * 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.
 */

package com.microsoft.azure.batch.protocol.models;

import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * The set of changes to be made to a Job.
 */
public class JobUpdateParameter {
    /**
     * 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. If omitted, it is
     * set to the default value 0.
     */
    @JsonProperty(value = "priority")
    private Integer priority;

    /**
     * The maximum number of tasks that can be executed in parallel for the
     * job.
     * The value of maxParallelTasks must be -1 or greater than 0 if specified.
     * If not specified, the default value is -1, which means there's no limit
     * to the number of tasks that can be run at once. You can update a job's
     * maxParallelTasks after it has been created using the update job API.
     */
    @JsonProperty(value = "maxParallelTasks")
    private Integer maxParallelTasks;

    /**
     * Whether Tasks in this job can be preempted by other high priority jobs.
     * If the value is set to True, other high priority jobs submitted to the
     * system will take precedence and will be able requeue tasks from this
     * job. You can update a job's allowTaskPreemption after it has been
     * created using the update job API.
     */
    @JsonProperty(value = "allowTaskPreemption")
    private Boolean allowTaskPreemption;

    /**
     * The execution constraints for the Job.
     * If omitted, the constraints are cleared.
     */
    @JsonProperty(value = "constraints")
    private JobConstraints constraints;

    /**
     * The Pool on which the Batch service runs the Job's Tasks.
     * You may change the Pool for a Job only when the Job is disabled. The
     * Update Job call will fail if you include the poolInfo element and the
     * Job is not disabled. If you specify an autoPoolSpecification in the
     * poolInfo, only the keepAlive property of the autoPoolSpecification can
     * be updated, and then only if the autoPoolSpecification has a
     * poolLifetimeOption of Job (other job properties can be updated as
     * normal).
     */
    @JsonProperty(value = "poolInfo", required = true)
    private PoolInformation poolInfo;

    /**
     * A list of name-value pairs associated with the Job as metadata.
     * If omitted, it takes the default value of an empty list; in effect, any
     * existing metadata is deleted.
     */
    @JsonProperty(value = "metadata")
    private List<MetadataItem> metadata;

    /**
     * The action the Batch service should take when all Tasks in the Job are
     * in the completed state.
     * If omitted, the completion behavior is set to noaction. If the current
     * value is terminatejob, this is an error because a Job's completion
     * behavior may not be changed from terminatejob to noaction. You may not
     * change the value from terminatejob to noaction - that is, once you have
     * engaged automatic Job termination, you cannot turn it off again. If you
     * try to do this, the request fails and Batch returns status code 400 (Bad
     * Request) and an 'invalid property value' error response. If you do not
     * specify this element in a PUT request, it is equivalent to passing
     * noaction. This is an error if the current value is terminatejob.
     * Possible values include: 'noAction', 'terminateJob'.
     */
    @JsonProperty(value = "onAllTasksComplete")
    private OnAllTasksComplete onAllTasksComplete;

    /**
     * Get priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If omitted, it is set to the default value 0.
     *
     * @return the priority value
     */
    public Integer priority() {
        return this.priority;
    }

    /**
     * Set priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If omitted, it is set to the default value 0.
     *
     * @param priority the priority value to set
     * @return the JobUpdateParameter object itself.
     */
    public JobUpdateParameter withPriority(Integer priority) {
        this.priority = priority;
        return this;
    }

    /**
     * Get the value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API.
     *
     * @return the maxParallelTasks value
     */
    public Integer maxParallelTasks() {
        return this.maxParallelTasks;
    }

    /**
     * Set the value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API.
     *
     * @param maxParallelTasks the maxParallelTasks value to set
     * @return the JobUpdateParameter object itself.
     */
    public JobUpdateParameter withMaxParallelTasks(Integer maxParallelTasks) {
        this.maxParallelTasks = maxParallelTasks;
        return this;
    }

    /**
     * Get if the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API.
     *
     * @return the allowTaskPreemption value
     */
    public Boolean allowTaskPreemption() {
        return this.allowTaskPreemption;
    }

    /**
     * Set if the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API.
     *
     * @param allowTaskPreemption the allowTaskPreemption value to set
     * @return the JobUpdateParameter object itself.
     */
    public JobUpdateParameter withAllowTaskPreemption(Boolean allowTaskPreemption) {
        this.allowTaskPreemption = allowTaskPreemption;
        return this;
    }

    /**
     * Get if omitted, the constraints are cleared.
     *
     * @return the constraints value
     */
    public JobConstraints constraints() {
        return this.constraints;
    }

    /**
     * Set if omitted, the constraints are cleared.
     *
     * @param constraints the constraints value to set
     * @return the JobUpdateParameter object itself.
     */
    public JobUpdateParameter withConstraints(JobConstraints constraints) {
        this.constraints = constraints;
        return this;
    }

    /**
     * Get you may change the Pool for a Job only when the Job is disabled. The Update Job call will fail if you include the poolInfo element and the Job is not disabled. If you specify an autoPoolSpecification in the poolInfo, only the keepAlive property of the autoPoolSpecification can be updated, and then only if the autoPoolSpecification has a poolLifetimeOption of Job (other job properties can be updated as normal).
     *
     * @return the poolInfo value
     */
    public PoolInformation poolInfo() {
        return this.poolInfo;
    }

    /**
     * Set you may change the Pool for a Job only when the Job is disabled. The Update Job call will fail if you include the poolInfo element and the Job is not disabled. If you specify an autoPoolSpecification in the poolInfo, only the keepAlive property of the autoPoolSpecification can be updated, and then only if the autoPoolSpecification has a poolLifetimeOption of Job (other job properties can be updated as normal).
     *
     * @param poolInfo the poolInfo value to set
     * @return the JobUpdateParameter object itself.
     */
    public JobUpdateParameter withPoolInfo(PoolInformation poolInfo) {
        this.poolInfo = poolInfo;
        return this;
    }

    /**
     * Get if omitted, it takes the default value of an empty list; in effect, any existing metadata is deleted.
     *
     * @return the metadata value
     */
    public List<MetadataItem> metadata() {
        return this.metadata;
    }

    /**
     * Set if omitted, it takes the default value of an empty list; in effect, any existing metadata is deleted.
     *
     * @param metadata the metadata value to set
     * @return the JobUpdateParameter object itself.
     */
    public JobUpdateParameter withMetadata(List<MetadataItem> metadata) {
        this.metadata = metadata;
        return this;
    }

    /**
     * Get if omitted, the completion behavior is set to noaction. If the current value is terminatejob, this is an error because a Job's completion behavior may not be changed from terminatejob to noaction. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic Job termination, you cannot turn it off again. If you try to do this, the request fails and Batch returns status code 400 (Bad Request) and an 'invalid property value' error response. If you do not specify this element in a PUT request, it is equivalent to passing noaction. This is an error if the current value is terminatejob. Possible values include: 'noAction', 'terminateJob'.
     *
     * @return the onAllTasksComplete value
     */
    public OnAllTasksComplete onAllTasksComplete() {
        return this.onAllTasksComplete;
    }

    /**
     * Set if omitted, the completion behavior is set to noaction. If the current value is terminatejob, this is an error because a Job's completion behavior may not be changed from terminatejob to noaction. You may not change the value from terminatejob to noaction - that is, once you have engaged automatic Job termination, you cannot turn it off again. If you try to do this, the request fails and Batch returns status code 400 (Bad Request) and an 'invalid property value' error response. If you do not specify this element in a PUT request, it is equivalent to passing noaction. This is an error if the current value is terminatejob. Possible values include: 'noAction', 'terminateJob'.
     *
     * @param onAllTasksComplete the onAllTasksComplete value to set
     * @return the JobUpdateParameter object itself.
     */
    public JobUpdateParameter withOnAllTasksComplete(OnAllTasksComplete onAllTasksComplete) {
        this.onAllTasksComplete = onAllTasksComplete;
        return this;
    }

}
