// 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.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** Defines an early termination policy that cancels a given percentage of runs at each evaluation interval. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "policyType")
@JsonTypeName("TruncationSelection")
@Fluent
public final class TruncationSelectionPolicy extends EarlyTerminationPolicy {
    /*
     * The percentage of runs to cancel at each evaluation interval.
     */
    @JsonProperty(value = "truncationPercentage")
    private Integer truncationPercentage;

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

    /**
     * Get the truncationPercentage property: The percentage of runs to cancel at each evaluation interval.
     *
     * @return the truncationPercentage value.
     */
    public Integer truncationPercentage() {
        return this.truncationPercentage;
    }

    /**
     * Set the truncationPercentage property: The percentage of runs to cancel at each evaluation interval.
     *
     * @param truncationPercentage the truncationPercentage value to set.
     * @return the TruncationSelectionPolicy object itself.
     */
    public TruncationSelectionPolicy withTruncationPercentage(Integer truncationPercentage) {
        this.truncationPercentage = truncationPercentage;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public TruncationSelectionPolicy withDelayEvaluation(Integer delayEvaluation) {
        super.withDelayEvaluation(delayEvaluation);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public TruncationSelectionPolicy withEvaluationInterval(Integer evaluationInterval) {
        super.withEvaluationInterval(evaluationInterval);
        return this;
    }

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