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

package com.azure.resourcemanager.networkcloud.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** ValidationThreshold indicates allowed machine and node hardware and deployment failures. */
@Fluent
public final class ValidationThreshold {
    /*
     * Selection of how the type evaluation is applied to the cluster calculation.
     */
    @JsonProperty(value = "grouping", required = true)
    private ValidationThresholdGrouping grouping;

    /*
     * Selection of how the threshold should be evaluated.
     */
    @JsonProperty(value = "type", required = true)
    private ValidationThresholdType type;

    /*
     * The numeric threshold value.
     */
    @JsonProperty(value = "value", required = true)
    private long value;

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

    /**
     * Get the grouping property: Selection of how the type evaluation is applied to the cluster calculation.
     *
     * @return the grouping value.
     */
    public ValidationThresholdGrouping grouping() {
        return this.grouping;
    }

    /**
     * Set the grouping property: Selection of how the type evaluation is applied to the cluster calculation.
     *
     * @param grouping the grouping value to set.
     * @return the ValidationThreshold object itself.
     */
    public ValidationThreshold withGrouping(ValidationThresholdGrouping grouping) {
        this.grouping = grouping;
        return this;
    }

    /**
     * Get the type property: Selection of how the threshold should be evaluated.
     *
     * @return the type value.
     */
    public ValidationThresholdType type() {
        return this.type;
    }

    /**
     * Set the type property: Selection of how the threshold should be evaluated.
     *
     * @param type the type value to set.
     * @return the ValidationThreshold object itself.
     */
    public ValidationThreshold withType(ValidationThresholdType type) {
        this.type = type;
        return this;
    }

    /**
     * Get the value property: The numeric threshold value.
     *
     * @return the value value.
     */
    public long value() {
        return this.value;
    }

    /**
     * Set the value property: The numeric threshold value.
     *
     * @param value the value value to set.
     * @return the ValidationThreshold object itself.
     */
    public ValidationThreshold withValue(long value) {
        this.value = value;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (grouping() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property grouping in model ValidationThreshold"));
        }
        if (type() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property type in model ValidationThreshold"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(ValidationThreshold.class);
}
