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

/** Early termination policies enable canceling poor-performing runs before they complete. */
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "policyType",
    defaultImpl = EarlyTerminationPolicy.class)
@JsonTypeName("EarlyTerminationPolicy")
@JsonSubTypes({
    @JsonSubTypes.Type(name = "Bandit", value = BanditPolicy.class),
    @JsonSubTypes.Type(name = "MedianStopping", value = MedianStoppingPolicy.class),
    @JsonSubTypes.Type(name = "TruncationSelection", value = TruncationSelectionPolicy.class)
})
@Fluent
public class EarlyTerminationPolicy {
    /*
     * Number of intervals by which to delay the first evaluation.
     */
    @JsonProperty(value = "delayEvaluation")
    private Integer delayEvaluation;

    /*
     * Interval (number of runs) between policy evaluations.
     */
    @JsonProperty(value = "evaluationInterval")
    private Integer evaluationInterval;

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

    /**
     * Get the delayEvaluation property: Number of intervals by which to delay the first evaluation.
     *
     * @return the delayEvaluation value.
     */
    public Integer delayEvaluation() {
        return this.delayEvaluation;
    }

    /**
     * Set the delayEvaluation property: Number of intervals by which to delay the first evaluation.
     *
     * @param delayEvaluation the delayEvaluation value to set.
     * @return the EarlyTerminationPolicy object itself.
     */
    public EarlyTerminationPolicy withDelayEvaluation(Integer delayEvaluation) {
        this.delayEvaluation = delayEvaluation;
        return this;
    }

    /**
     * Get the evaluationInterval property: Interval (number of runs) between policy evaluations.
     *
     * @return the evaluationInterval value.
     */
    public Integer evaluationInterval() {
        return this.evaluationInterval;
    }

    /**
     * Set the evaluationInterval property: Interval (number of runs) between policy evaluations.
     *
     * @param evaluationInterval the evaluationInterval value to set.
     * @return the EarlyTerminationPolicy object itself.
     */
    public EarlyTerminationPolicy withEvaluationInterval(Integer evaluationInterval) {
        this.evaluationInterval = evaluationInterval;
        return this;
    }

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