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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.managednetworkfabric.models.NetworkDeviceRoleProperties;
import com.azure.resourcemanager.managednetworkfabric.models.NetworkRackRoleName;
import com.azure.resourcemanager.managednetworkfabric.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** NetworkRackSkuProperties define the resource properties. */
@Fluent
public final class NetworkRackSkuProperties {
    /*
     * The role of the Network Rack: Aggregate or Compute.
     */
    @JsonProperty(value = "roleName", required = true)
    private NetworkRackRoleName roleName;

    /*
     * Maximum number of servers available for this SKU.
     */
    @JsonProperty(value = "maximumServerCount")
    private Integer maximumServerCount;

    /*
     * Maximum number of storage devices available for this SKU.
     */
    @JsonProperty(value = "maximumStorageCount")
    private Integer maximumStorageCount;

    /*
     * Maximum number of network uplinks available for this SKU.
     */
    @JsonProperty(value = "maximumUplinks")
    private Integer maximumUplinks;

    /*
     * List of network device properties / role for the Network Rack.
     */
    @JsonProperty(value = "networkDevices")
    private List<NetworkDeviceRoleProperties> networkDevices;

    /*
     * Gets the provisioning state of the resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

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

    /**
     * Get the roleName property: The role of the Network Rack: Aggregate or Compute.
     *
     * @return the roleName value.
     */
    public NetworkRackRoleName roleName() {
        return this.roleName;
    }

    /**
     * Set the roleName property: The role of the Network Rack: Aggregate or Compute.
     *
     * @param roleName the roleName value to set.
     * @return the NetworkRackSkuProperties object itself.
     */
    public NetworkRackSkuProperties withRoleName(NetworkRackRoleName roleName) {
        this.roleName = roleName;
        return this;
    }

    /**
     * Get the maximumServerCount property: Maximum number of servers available for this SKU.
     *
     * @return the maximumServerCount value.
     */
    public Integer maximumServerCount() {
        return this.maximumServerCount;
    }

    /**
     * Set the maximumServerCount property: Maximum number of servers available for this SKU.
     *
     * @param maximumServerCount the maximumServerCount value to set.
     * @return the NetworkRackSkuProperties object itself.
     */
    public NetworkRackSkuProperties withMaximumServerCount(Integer maximumServerCount) {
        this.maximumServerCount = maximumServerCount;
        return this;
    }

    /**
     * Get the maximumStorageCount property: Maximum number of storage devices available for this SKU.
     *
     * @return the maximumStorageCount value.
     */
    public Integer maximumStorageCount() {
        return this.maximumStorageCount;
    }

    /**
     * Set the maximumStorageCount property: Maximum number of storage devices available for this SKU.
     *
     * @param maximumStorageCount the maximumStorageCount value to set.
     * @return the NetworkRackSkuProperties object itself.
     */
    public NetworkRackSkuProperties withMaximumStorageCount(Integer maximumStorageCount) {
        this.maximumStorageCount = maximumStorageCount;
        return this;
    }

    /**
     * Get the maximumUplinks property: Maximum number of network uplinks available for this SKU.
     *
     * @return the maximumUplinks value.
     */
    public Integer maximumUplinks() {
        return this.maximumUplinks;
    }

    /**
     * Set the maximumUplinks property: Maximum number of network uplinks available for this SKU.
     *
     * @param maximumUplinks the maximumUplinks value to set.
     * @return the NetworkRackSkuProperties object itself.
     */
    public NetworkRackSkuProperties withMaximumUplinks(Integer maximumUplinks) {
        this.maximumUplinks = maximumUplinks;
        return this;
    }

    /**
     * Get the networkDevices property: List of network device properties / role for the Network Rack.
     *
     * @return the networkDevices value.
     */
    public List<NetworkDeviceRoleProperties> networkDevices() {
        return this.networkDevices;
    }

    /**
     * Set the networkDevices property: List of network device properties / role for the Network Rack.
     *
     * @param networkDevices the networkDevices value to set.
     * @return the NetworkRackSkuProperties object itself.
     */
    public NetworkRackSkuProperties withNetworkDevices(List<NetworkDeviceRoleProperties> networkDevices) {
        this.networkDevices = networkDevices;
        return this;
    }

    /**
     * Get the provisioningState property: Gets the provisioning state of the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (roleName() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property roleName in model NetworkRackSkuProperties"));
        }
        if (networkDevices() != null) {
            networkDevices().forEach(e -> e.validate());
        }
    }

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