// 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;
import java.time.Duration;

/** The TargetUtilizationScaleSettings model. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "scaleType")
@JsonTypeName("TargetUtilization")
@Fluent
public final class TargetUtilizationScaleSettings extends OnlineScaleSettings {
    /*
     * The maximum number of instances that the deployment can scale to. The quota will be reserved for max_instances.
     */
    @JsonProperty(value = "maxInstances")
    private Integer maxInstances;

    /*
     * The minimum number of instances to always be present.
     */
    @JsonProperty(value = "minInstances")
    private Integer minInstances;

    /*
     * The polling interval in ISO 8691 format. Only supports duration with precision as low as Seconds.
     */
    @JsonProperty(value = "pollingInterval")
    private Duration pollingInterval;

    /*
     * Target CPU usage for the autoscaler.
     */
    @JsonProperty(value = "targetUtilizationPercentage")
    private Integer targetUtilizationPercentage;

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

    /**
     * Get the maxInstances property: The maximum number of instances that the deployment can scale to. The quota will
     * be reserved for max_instances.
     *
     * @return the maxInstances value.
     */
    public Integer maxInstances() {
        return this.maxInstances;
    }

    /**
     * Set the maxInstances property: The maximum number of instances that the deployment can scale to. The quota will
     * be reserved for max_instances.
     *
     * @param maxInstances the maxInstances value to set.
     * @return the TargetUtilizationScaleSettings object itself.
     */
    public TargetUtilizationScaleSettings withMaxInstances(Integer maxInstances) {
        this.maxInstances = maxInstances;
        return this;
    }

    /**
     * Get the minInstances property: The minimum number of instances to always be present.
     *
     * @return the minInstances value.
     */
    public Integer minInstances() {
        return this.minInstances;
    }

    /**
     * Set the minInstances property: The minimum number of instances to always be present.
     *
     * @param minInstances the minInstances value to set.
     * @return the TargetUtilizationScaleSettings object itself.
     */
    public TargetUtilizationScaleSettings withMinInstances(Integer minInstances) {
        this.minInstances = minInstances;
        return this;
    }

    /**
     * Get the pollingInterval property: The polling interval in ISO 8691 format. Only supports duration with precision
     * as low as Seconds.
     *
     * @return the pollingInterval value.
     */
    public Duration pollingInterval() {
        return this.pollingInterval;
    }

    /**
     * Set the pollingInterval property: The polling interval in ISO 8691 format. Only supports duration with precision
     * as low as Seconds.
     *
     * @param pollingInterval the pollingInterval value to set.
     * @return the TargetUtilizationScaleSettings object itself.
     */
    public TargetUtilizationScaleSettings withPollingInterval(Duration pollingInterval) {
        this.pollingInterval = pollingInterval;
        return this;
    }

    /**
     * Get the targetUtilizationPercentage property: Target CPU usage for the autoscaler.
     *
     * @return the targetUtilizationPercentage value.
     */
    public Integer targetUtilizationPercentage() {
        return this.targetUtilizationPercentage;
    }

    /**
     * Set the targetUtilizationPercentage property: Target CPU usage for the autoscaler.
     *
     * @param targetUtilizationPercentage the targetUtilizationPercentage value to set.
     * @return the TargetUtilizationScaleSettings object itself.
     */
    public TargetUtilizationScaleSettings withTargetUtilizationPercentage(Integer targetUtilizationPercentage) {
        this.targetUtilizationPercentage = targetUtilizationPercentage;
        return this;
    }

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