// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.machinelearning.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.Duration;

/** The JobLimits model. */
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "jobLimitsType",
    defaultImpl = JobLimits.class)
@JsonTypeName("JobLimits")
@JsonSubTypes({
    @JsonSubTypes.Type(name = "Command", value = CommandJobLimits.class),
    @JsonSubTypes.Type(name = "Sweep", value = SweepJobLimits.class)
})
@Fluent
public class JobLimits {
    /*
     * The max run duration in ISO 8601 format, after which the job will be cancelled. Only supports duration with
     * precision as low as Seconds.
     */
    @JsonProperty(value = "timeout")
    private Duration timeout;

    /** Creates an instance of JobLimits class. */
    public JobLimits() {
    }

    /**
     * Get the timeout property: The max run duration in ISO 8601 format, after which the job will be cancelled. Only
     * supports duration with precision as low as Seconds.
     *
     * @return the timeout value.
     */
    public Duration timeout() {
        return this.timeout;
    }

    /**
     * Set the timeout property: The max run duration in ISO 8601 format, after which the job will be cancelled. Only
     * supports duration with precision as low as Seconds.
     *
     * @param timeout the timeout value to set.
     * @return the JobLimits object itself.
     */
    public JobLimits withTimeout(Duration timeout) {
        this.timeout = timeout;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }
}
