// 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 based on slack criteria, and a frequency and delay interval for evaluation. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "policyType")
@JsonTypeName("Bandit")
@Fluent
public final class BanditPolicy extends EarlyTerminationPolicy {
    /*
     * Absolute distance allowed from the best performing run.
     */
    @JsonProperty(value = "slackAmount")
    private Float slackAmount;

    /*
     * Ratio of the allowed distance from the best performing run.
     */
    @JsonProperty(value = "slackFactor")
    private Float slackFactor;

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

    /**
     * Get the slackAmount property: Absolute distance allowed from the best performing run.
     *
     * @return the slackAmount value.
     */
    public Float slackAmount() {
        return this.slackAmount;
    }

    /**
     * Set the slackAmount property: Absolute distance allowed from the best performing run.
     *
     * @param slackAmount the slackAmount value to set.
     * @return the BanditPolicy object itself.
     */
    public BanditPolicy withSlackAmount(Float slackAmount) {
        this.slackAmount = slackAmount;
        return this;
    }

    /**
     * Get the slackFactor property: Ratio of the allowed distance from the best performing run.
     *
     * @return the slackFactor value.
     */
    public Float slackFactor() {
        return this.slackFactor;
    }

    /**
     * Set the slackFactor property: Ratio of the allowed distance from the best performing run.
     *
     * @param slackFactor the slackFactor value to set.
     * @return the BanditPolicy object itself.
     */
    public BanditPolicy withSlackFactor(Float slackFactor) {
        this.slackFactor = slackFactor;
        return this;
    }

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

    /** {@inheritDoc} */
    @Override
    public BanditPolicy 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();
    }
}
