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

package com.azure.resourcemanager.reservations.models;

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

/** Quota properties for the resource. */
@Fluent
public final class QuotaProperties {
    /*
     * Quota properties.
     */
    @JsonProperty(value = "limit")
    private Integer limit;

    /*
     * Current usage value for the resource.
     */
    @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY)
    private Integer currentValue;

    /*
     * The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota
     * operation.
     */
    @JsonProperty(value = "unit")
    private String unit;

    /*
     * Name of the resource provide by the resource provider. Use this property for quotaRequests resource operations.
     */
    @JsonProperty(value = "name")
    private ResourceName name;

    /*
     * The name of the resource type.
     */
    @JsonProperty(value = "resourceType")
    private ResourceType resourceType;

    /*
     * The time period over which the quota usage values are summarized. For example, P1D (per one day), PT1M (per one
     * minute), and PT1S (per one second). This parameter is optional because, for some resources such as compute, the
     * time period is irrelevant.
     */
    @JsonProperty(value = "quotaPeriod", access = JsonProperty.Access.WRITE_ONLY)
    private String quotaPeriod;

    /*
     * Additional properties for the specified resource provider.
     */
    @JsonProperty(value = "properties")
    private Object properties;

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

    /**
     * Get the limit property: Quota properties.
     *
     * @return the limit value.
     */
    public Integer limit() {
        return this.limit;
    }

    /**
     * Set the limit property: Quota properties.
     *
     * @param limit the limit value to set.
     * @return the QuotaProperties object itself.
     */
    public QuotaProperties withLimit(Integer limit) {
        this.limit = limit;
        return this;
    }

    /**
     * Get the currentValue property: Current usage value for the resource.
     *
     * @return the currentValue value.
     */
    public Integer currentValue() {
        return this.currentValue;
    }

    /**
     * Get the unit property: The limit units, such as **count** and **bytes**. Use the unit field provided in the
     * response of the GET quota operation.
     *
     * @return the unit value.
     */
    public String unit() {
        return this.unit;
    }

    /**
     * Set the unit property: The limit units, such as **count** and **bytes**. Use the unit field provided in the
     * response of the GET quota operation.
     *
     * @param unit the unit value to set.
     * @return the QuotaProperties object itself.
     */
    public QuotaProperties withUnit(String unit) {
        this.unit = unit;
        return this;
    }

    /**
     * Get the name property: Name of the resource provide by the resource provider. Use this property for quotaRequests
     * resource operations.
     *
     * @return the name value.
     */
    public ResourceName name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the resource provide by the resource provider. Use this property for quotaRequests
     * resource operations.
     *
     * @param name the name value to set.
     * @return the QuotaProperties object itself.
     */
    public QuotaProperties withName(ResourceName name) {
        this.name = name;
        return this;
    }

    /**
     * Get the resourceType property: The name of the resource type.
     *
     * @return the resourceType value.
     */
    public ResourceType resourceType() {
        return this.resourceType;
    }

    /**
     * Set the resourceType property: The name of the resource type.
     *
     * @param resourceType the resourceType value to set.
     * @return the QuotaProperties object itself.
     */
    public QuotaProperties withResourceType(ResourceType resourceType) {
        this.resourceType = resourceType;
        return this;
    }

    /**
     * Get the quotaPeriod property: The time period over which the quota usage values are summarized. For example, P1D
     * (per one day), PT1M (per one minute), and PT1S (per one second). This parameter is optional because, for some
     * resources such as compute, the time period is irrelevant.
     *
     * @return the quotaPeriod value.
     */
    public String quotaPeriod() {
        return this.quotaPeriod;
    }

    /**
     * Get the properties property: Additional properties for the specified resource provider.
     *
     * @return the properties value.
     */
    public Object properties() {
        return this.properties;
    }

    /**
     * Set the properties property: Additional properties for the specified resource provider.
     *
     * @param properties the properties value to set.
     * @return the QuotaProperties object itself.
     */
    public QuotaProperties withProperties(Object properties) {
        this.properties = properties;
        return this;
    }

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