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

package com.azure.resourcemanager.recoveryservicesbackup.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.recoveryservicesbackup.models.NameInfo;
import com.azure.resourcemanager.recoveryservicesbackup.models.UsagesUnit;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Backup management usages of a vault. */
@Fluent
public final class BackupManagementUsageInner {
    /*
     * Unit of the usage.
     */
    @JsonProperty(value = "unit")
    private UsagesUnit unit;

    /*
     * Quota period of usage.
     */
    @JsonProperty(value = "quotaPeriod")
    private String quotaPeriod;

    /*
     * Next reset time of usage.
     */
    @JsonProperty(value = "nextResetTime")
    private OffsetDateTime nextResetTime;

    /*
     * Current value of usage.
     */
    @JsonProperty(value = "currentValue")
    private Long currentValue;

    /*
     * Limit of usage.
     */
    @JsonProperty(value = "limit")
    private Long limit;

    /*
     * Name of usage.
     */
    @JsonProperty(value = "name")
    private NameInfo name;

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

    /**
     * Get the unit property: Unit of the usage.
     *
     * @return the unit value.
     */
    public UsagesUnit unit() {
        return this.unit;
    }

    /**
     * Set the unit property: Unit of the usage.
     *
     * @param unit the unit value to set.
     * @return the BackupManagementUsageInner object itself.
     */
    public BackupManagementUsageInner withUnit(UsagesUnit unit) {
        this.unit = unit;
        return this;
    }

    /**
     * Get the quotaPeriod property: Quota period of usage.
     *
     * @return the quotaPeriod value.
     */
    public String quotaPeriod() {
        return this.quotaPeriod;
    }

    /**
     * Set the quotaPeriod property: Quota period of usage.
     *
     * @param quotaPeriod the quotaPeriod value to set.
     * @return the BackupManagementUsageInner object itself.
     */
    public BackupManagementUsageInner withQuotaPeriod(String quotaPeriod) {
        this.quotaPeriod = quotaPeriod;
        return this;
    }

    /**
     * Get the nextResetTime property: Next reset time of usage.
     *
     * @return the nextResetTime value.
     */
    public OffsetDateTime nextResetTime() {
        return this.nextResetTime;
    }

    /**
     * Set the nextResetTime property: Next reset time of usage.
     *
     * @param nextResetTime the nextResetTime value to set.
     * @return the BackupManagementUsageInner object itself.
     */
    public BackupManagementUsageInner withNextResetTime(OffsetDateTime nextResetTime) {
        this.nextResetTime = nextResetTime;
        return this;
    }

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

    /**
     * Set the currentValue property: Current value of usage.
     *
     * @param currentValue the currentValue value to set.
     * @return the BackupManagementUsageInner object itself.
     */
    public BackupManagementUsageInner withCurrentValue(Long currentValue) {
        this.currentValue = currentValue;
        return this;
    }

    /**
     * Get the limit property: Limit of usage.
     *
     * @return the limit value.
     */
    public Long limit() {
        return this.limit;
    }

    /**
     * Set the limit property: Limit of usage.
     *
     * @param limit the limit value to set.
     * @return the BackupManagementUsageInner object itself.
     */
    public BackupManagementUsageInner withLimit(Long limit) {
        this.limit = limit;
        return this;
    }

    /**
     * Get the name property: Name of usage.
     *
     * @return the name value.
     */
    public NameInfo name() {
        return this.name;
    }

    /**
     * Set the name property: Name of usage.
     *
     * @param name the name value to set.
     * @return the BackupManagementUsageInner object itself.
     */
    public BackupManagementUsageInner withName(NameInfo name) {
        this.name = name;
        return this;
    }

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