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

package com.azure.resourcemanager.hdinsight.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The autoscale request parameters. */
@Fluent
public final class Autoscale {
    /*
     * Parameters for load-based autoscale
     */
    @JsonProperty(value = "capacity")
    private AutoscaleCapacity capacity;

    /*
     * Parameters for schedule-based autoscale
     */
    @JsonProperty(value = "recurrence")
    private AutoscaleRecurrence recurrence;

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

    /**
     * Get the capacity property: Parameters for load-based autoscale.
     *
     * @return the capacity value.
     */
    public AutoscaleCapacity capacity() {
        return this.capacity;
    }

    /**
     * Set the capacity property: Parameters for load-based autoscale.
     *
     * @param capacity the capacity value to set.
     * @return the Autoscale object itself.
     */
    public Autoscale withCapacity(AutoscaleCapacity capacity) {
        this.capacity = capacity;
        return this;
    }

    /**
     * Get the recurrence property: Parameters for schedule-based autoscale.
     *
     * @return the recurrence value.
     */
    public AutoscaleRecurrence recurrence() {
        return this.recurrence;
    }

    /**
     * Set the recurrence property: Parameters for schedule-based autoscale.
     *
     * @param recurrence the recurrence value to set.
     * @return the Autoscale object itself.
     */
    public Autoscale withRecurrence(AutoscaleRecurrence recurrence) {
        this.recurrence = recurrence;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (capacity() != null) {
            capacity().validate();
        }
        if (recurrence() != null) {
            recurrence().validate();
        }
    }
}
