// 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;

/** The sub-request submitted with the quota request. */
@Fluent
public final class SubRequest {
    /*
     * Quota (resource limit).
     */
    @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY)
    private Integer limit;

    /*
     * The resource name.
     */
    @JsonProperty(value = "name")
    private ResourceName name;

    /*
     * Resource type for which the quota check was made.
     */
    @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY)
    private String resourceType;

    /*
     * 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;

    /*
     * The quota request status.
     */
    @JsonProperty(value = "provisioningState")
    private QuotaRequestState provisioningState;

    /*
     * User-friendly status message.
     */
    @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY)
    private String message;

    /*
     * Sub request ID for individual request.
     */
    @JsonProperty(value = "subRequestId", access = JsonProperty.Access.WRITE_ONLY)
    private String subRequestId;

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

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

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

    /**
     * Set the name property: The resource name.
     *
     * @param name the name value to set.
     * @return the SubRequest object itself.
     */
    public SubRequest withName(ResourceName name) {
        this.name = name;
        return this;
    }

    /**
     * Get the resourceType property: Resource type for which the quota check was made.
     *
     * @return the resourceType value.
     */
    public String resourceType() {
        return this.resourceType;
    }

    /**
     * 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 SubRequest object itself.
     */
    public SubRequest withUnit(String unit) {
        this.unit = unit;
        return this;
    }

    /**
     * Get the provisioningState property: The quota request status.
     *
     * @return the provisioningState value.
     */
    public QuotaRequestState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Set the provisioningState property: The quota request status.
     *
     * @param provisioningState the provisioningState value to set.
     * @return the SubRequest object itself.
     */
    public SubRequest withProvisioningState(QuotaRequestState provisioningState) {
        this.provisioningState = provisioningState;
        return this;
    }

    /**
     * Get the message property: User-friendly status message.
     *
     * @return the message value.
     */
    public String message() {
        return this.message;
    }

    /**
     * Get the subRequestId property: Sub request ID for individual request.
     *
     * @return the subRequestId value.
     */
    public String subRequestId() {
        return this.subRequestId;
    }

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