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

package com.azure.resourcemanager.cognitiveservices.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The QuotaLimit model. */
@Fluent
public final class QuotaLimit {
    /*
     * The count property.
     */
    @JsonProperty(value = "count")
    private Float count;

    /*
     * The renewalPeriod property.
     */
    @JsonProperty(value = "renewalPeriod")
    private Float renewalPeriod;

    /*
     * The rules property.
     */
    @JsonProperty(value = "rules")
    private List<ThrottlingRule> rules;

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

    /**
     * Get the count property: The count property.
     *
     * @return the count value.
     */
    public Float count() {
        return this.count;
    }

    /**
     * Set the count property: The count property.
     *
     * @param count the count value to set.
     * @return the QuotaLimit object itself.
     */
    public QuotaLimit withCount(Float count) {
        this.count = count;
        return this;
    }

    /**
     * Get the renewalPeriod property: The renewalPeriod property.
     *
     * @return the renewalPeriod value.
     */
    public Float renewalPeriod() {
        return this.renewalPeriod;
    }

    /**
     * Set the renewalPeriod property: The renewalPeriod property.
     *
     * @param renewalPeriod the renewalPeriod value to set.
     * @return the QuotaLimit object itself.
     */
    public QuotaLimit withRenewalPeriod(Float renewalPeriod) {
        this.renewalPeriod = renewalPeriod;
        return this;
    }

    /**
     * Get the rules property: The rules property.
     *
     * @return the rules value.
     */
    public List<ThrottlingRule> rules() {
        return this.rules;
    }

    /**
     * Set the rules property: The rules property.
     *
     * @param rules the rules value to set.
     * @return the QuotaLimit object itself.
     */
    public QuotaLimit withRules(List<ThrottlingRule> rules) {
        this.rules = rules;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (rules() != null) {
            rules().forEach(e -> e.validate());
        }
    }
}
