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

/**
 * Specifies how the Batch service should respond when the Task completes.
 */
public class ExitConditions {
    /**
     * A list of individual Task exit codes and how the Batch service should
     * respond to them.
     */
    @JsonProperty(value = "exitCodes")
    private List<ExitCodeMapping> exitCodes;

    /**
     * A list of Task exit code ranges and how the Batch service should respond
     * to them.
     */
    @JsonProperty(value = "exitCodeRanges")
    private List<ExitCodeRangeMapping> exitCodeRanges;

    /**
     * How the Batch service should respond if the Task fails to start due to
     * an error.
     */
    @JsonProperty(value = "preProcessingError")
    private ExitOptions preProcessingError;

    /**
     * How the Batch service should respond if a file upload error occurs.
     * If the Task exited with an exit code that was specified via exitCodes or
     * exitCodeRanges, and then encountered a file upload error, then the
     * action specified by the exit code takes precedence.
     */
    @JsonProperty(value = "fileUploadError")
    private ExitOptions fileUploadError;

    /**
     * How the Batch service should respond if the Task fails with an exit
     * condition not covered by any of the other properties.
     * This value is used if the Task exits with any nonzero exit code not
     * listed in the exitCodes or exitCodeRanges collection, with a
     * pre-processing error if the preProcessingError property is not present,
     * or with a file upload error if the fileUploadError property is not
     * present. If you want non-default behavior on exit code 0, you must list
     * it explicitly using the exitCodes or exitCodeRanges collection.
     */
    @JsonProperty(value = "default")
    private ExitOptions defaultProperty;

    /**
     * Get the exitCodes value.
     *
     * @return the exitCodes value
     */
    public List<ExitCodeMapping> exitCodes() {
        return this.exitCodes;
    }

    /**
     * Set the exitCodes value.
     *
     * @param exitCodes the exitCodes value to set
     * @return the ExitConditions object itself.
     */
    public ExitConditions withExitCodes(List<ExitCodeMapping> exitCodes) {
        this.exitCodes = exitCodes;
        return this;
    }

    /**
     * Get the exitCodeRanges value.
     *
     * @return the exitCodeRanges value
     */
    public List<ExitCodeRangeMapping> exitCodeRanges() {
        return this.exitCodeRanges;
    }

    /**
     * Set the exitCodeRanges value.
     *
     * @param exitCodeRanges the exitCodeRanges value to set
     * @return the ExitConditions object itself.
     */
    public ExitConditions withExitCodeRanges(List<ExitCodeRangeMapping> exitCodeRanges) {
        this.exitCodeRanges = exitCodeRanges;
        return this;
    }

    /**
     * Get the preProcessingError value.
     *
     * @return the preProcessingError value
     */
    public ExitOptions preProcessingError() {
        return this.preProcessingError;
    }

    /**
     * Set the preProcessingError value.
     *
     * @param preProcessingError the preProcessingError value to set
     * @return the ExitConditions object itself.
     */
    public ExitConditions withPreProcessingError(ExitOptions preProcessingError) {
        this.preProcessingError = preProcessingError;
        return this;
    }

    /**
     * Get if the Task exited with an exit code that was specified via exitCodes or exitCodeRanges, and then encountered a file upload error, then the action specified by the exit code takes precedence.
     *
     * @return the fileUploadError value
     */
    public ExitOptions fileUploadError() {
        return this.fileUploadError;
    }

    /**
     * Set if the Task exited with an exit code that was specified via exitCodes or exitCodeRanges, and then encountered a file upload error, then the action specified by the exit code takes precedence.
     *
     * @param fileUploadError the fileUploadError value to set
     * @return the ExitConditions object itself.
     */
    public ExitConditions withFileUploadError(ExitOptions fileUploadError) {
        this.fileUploadError = fileUploadError;
        return this;
    }

    /**
     * Get this value is used if the Task exits with any nonzero exit code not listed in the exitCodes or exitCodeRanges collection, with a pre-processing error if the preProcessingError property is not present, or with a file upload error if the fileUploadError property is not present. If you want non-default behavior on exit code 0, you must list it explicitly using the exitCodes or exitCodeRanges collection.
     *
     * @return the defaultProperty value
     */
    public ExitOptions defaultProperty() {
        return this.defaultProperty;
    }

    /**
     * Set this value is used if the Task exits with any nonzero exit code not listed in the exitCodes or exitCodeRanges collection, with a pre-processing error if the preProcessingError property is not present, or with a file upload error if the fileUploadError property is not present. If you want non-default behavior on exit code 0, you must list it explicitly using the exitCodes or exitCodeRanges collection.
     *
     * @param defaultProperty the defaultProperty value to set
     * @return the ExitConditions object itself.
     */
    public ExitConditions withDefaultProperty(ExitOptions defaultProperty) {
        this.defaultProperty = defaultProperty;
        return this;
    }

}
