// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.networkcloud.models.ClusterAvailableUpgradeVersion;
import com.azure.resourcemanager.networkcloud.models.ClusterCapacity;
import com.azure.resourcemanager.networkcloud.models.ClusterConnectionStatus;
import com.azure.resourcemanager.networkcloud.models.ClusterDetailedStatus;
import com.azure.resourcemanager.networkcloud.models.ClusterManagerConnectionStatus;
import com.azure.resourcemanager.networkcloud.models.ClusterProvisioningState;
import com.azure.resourcemanager.networkcloud.models.ClusterType;
import com.azure.resourcemanager.networkcloud.models.ExtendedLocation;
import com.azure.resourcemanager.networkcloud.models.ManagedResourceGroupConfiguration;
import com.azure.resourcemanager.networkcloud.models.RackDefinition;
import com.azure.resourcemanager.networkcloud.models.ServicePrincipalInformation;
import com.azure.resourcemanager.networkcloud.models.ValidationThreshold;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Cluster represents the on-premises Network Cloud cluster. */
@Fluent
public final class ClusterInner extends Resource {
    /*
     * ExtendedLocation represents the Azure custom location where the resource will be created.
     *
     * The extended location of the cluster manager associated with the cluster.
     */
    @JsonProperty(value = "extendedLocation", required = true)
    private ExtendedLocation extendedLocation;

    /*
     * ClusterProperties represents the properties of a cluster.
     *
     * The list of the resource properties.
     */
    @JsonProperty(value = "properties", required = true)
    private ClusterProperties innerProperties = new ClusterProperties();

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the extendedLocation property: ExtendedLocation represents the Azure custom location where the resource will
     * be created.
     *
     * <p>The extended location of the cluster manager associated with the cluster.
     *
     * @return the extendedLocation value.
     */
    public ExtendedLocation extendedLocation() {
        return this.extendedLocation;
    }

    /**
     * Set the extendedLocation property: ExtendedLocation represents the Azure custom location where the resource will
     * be created.
     *
     * <p>The extended location of the cluster manager associated with the cluster.
     *
     * @param extendedLocation the extendedLocation value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withExtendedLocation(ExtendedLocation extendedLocation) {
        this.extendedLocation = extendedLocation;
        return this;
    }

    /**
     * Get the innerProperties property: ClusterProperties represents the properties of a cluster.
     *
     * <p>The list of the resource properties.
     *
     * @return the innerProperties value.
     */
    private ClusterProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /** {@inheritDoc} */
    @Override
    public ClusterInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ClusterInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the aggregatorOrSingleRackDefinition property: RackDefinition represents details regarding the rack.
     *
     * <p>The rack definition that is intended to reflect only a single rack in a single rack cluster, or an aggregator
     * rack in a multi-rack cluster.
     *
     * @return the aggregatorOrSingleRackDefinition value.
     */
    public RackDefinition aggregatorOrSingleRackDefinition() {
        return this.innerProperties() == null ? null : this.innerProperties().aggregatorOrSingleRackDefinition();
    }

    /**
     * Set the aggregatorOrSingleRackDefinition property: RackDefinition represents details regarding the rack.
     *
     * <p>The rack definition that is intended to reflect only a single rack in a single rack cluster, or an aggregator
     * rack in a multi-rack cluster.
     *
     * @param aggregatorOrSingleRackDefinition the aggregatorOrSingleRackDefinition value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withAggregatorOrSingleRackDefinition(RackDefinition aggregatorOrSingleRackDefinition) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withAggregatorOrSingleRackDefinition(aggregatorOrSingleRackDefinition);
        return this;
    }

    /**
     * Get the analyticsWorkspaceId property: The resource ID of the Log Analytics Workspace that will be used for
     * storing relevant logs.
     *
     * @return the analyticsWorkspaceId value.
     */
    public String analyticsWorkspaceId() {
        return this.innerProperties() == null ? null : this.innerProperties().analyticsWorkspaceId();
    }

    /**
     * Set the analyticsWorkspaceId property: The resource ID of the Log Analytics Workspace that will be used for
     * storing relevant logs.
     *
     * @param analyticsWorkspaceId the analyticsWorkspaceId value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withAnalyticsWorkspaceId(String analyticsWorkspaceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withAnalyticsWorkspaceId(analyticsWorkspaceId);
        return this;
    }

    /**
     * Get the availableUpgradeVersions property: The list of cluster runtime version upgrades available for this
     * cluster.
     *
     * @return the availableUpgradeVersions value.
     */
    public List<ClusterAvailableUpgradeVersion> availableUpgradeVersions() {
        return this.innerProperties() == null ? null : this.innerProperties().availableUpgradeVersions();
    }

    /**
     * Get the clusterCapacity property: ClusterCapacity represents various details regarding compute capacity.
     *
     * <p>The capacity supported by this cluster.
     *
     * @return the clusterCapacity value.
     */
    public ClusterCapacity clusterCapacity() {
        return this.innerProperties() == null ? null : this.innerProperties().clusterCapacity();
    }

    /**
     * Get the clusterConnectionStatus property: The latest heartbeat status between the cluster manager and the
     * cluster.
     *
     * @return the clusterConnectionStatus value.
     */
    public ClusterConnectionStatus clusterConnectionStatus() {
        return this.innerProperties() == null ? null : this.innerProperties().clusterConnectionStatus();
    }

    /**
     * Get the clusterExtendedLocation property: ExtendedLocation represents the Azure custom location where the
     * resource will be created.
     *
     * <p>The extended location (custom location) that represents the cluster's control plane location. This extended
     * location is used to route the requests of child objects of the cluster that are handled by the platform operator.
     *
     * @return the clusterExtendedLocation value.
     */
    public ExtendedLocation clusterExtendedLocation() {
        return this.innerProperties() == null ? null : this.innerProperties().clusterExtendedLocation();
    }

    /**
     * Get the clusterLocation property: The customer-provided location information to identify where the cluster
     * resides.
     *
     * @return the clusterLocation value.
     */
    public String clusterLocation() {
        return this.innerProperties() == null ? null : this.innerProperties().clusterLocation();
    }

    /**
     * Set the clusterLocation property: The customer-provided location information to identify where the cluster
     * resides.
     *
     * @param clusterLocation the clusterLocation value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withClusterLocation(String clusterLocation) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withClusterLocation(clusterLocation);
        return this;
    }

    /**
     * Get the clusterManagerConnectionStatus property: The latest connectivity status between cluster manager and the
     * cluster.
     *
     * @return the clusterManagerConnectionStatus value.
     */
    public ClusterManagerConnectionStatus clusterManagerConnectionStatus() {
        return this.innerProperties() == null ? null : this.innerProperties().clusterManagerConnectionStatus();
    }

    /**
     * Get the clusterManagerId property: The resource ID of the cluster manager that manages this cluster. This is set
     * by the Cluster Manager when the cluster is created.
     *
     * @return the clusterManagerId value.
     */
    public String clusterManagerId() {
        return this.innerProperties() == null ? null : this.innerProperties().clusterManagerId();
    }

    /**
     * Get the clusterServicePrincipal property: ServicePrincipalInformation represents the details of the service
     * principal to be used by the cluster during Arc Appliance installation.
     *
     * <p>The service principal to be used by the cluster during Arc Appliance installation.
     *
     * @return the clusterServicePrincipal value.
     */
    public ServicePrincipalInformation clusterServicePrincipal() {
        return this.innerProperties() == null ? null : this.innerProperties().clusterServicePrincipal();
    }

    /**
     * Set the clusterServicePrincipal property: ServicePrincipalInformation represents the details of the service
     * principal to be used by the cluster during Arc Appliance installation.
     *
     * <p>The service principal to be used by the cluster during Arc Appliance installation.
     *
     * @param clusterServicePrincipal the clusterServicePrincipal value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withClusterServicePrincipal(ServicePrincipalInformation clusterServicePrincipal) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withClusterServicePrincipal(clusterServicePrincipal);
        return this;
    }

    /**
     * Get the clusterType property: The type of rack configuration for the cluster.
     *
     * @return the clusterType value.
     */
    public ClusterType clusterType() {
        return this.innerProperties() == null ? null : this.innerProperties().clusterType();
    }

    /**
     * Set the clusterType property: The type of rack configuration for the cluster.
     *
     * @param clusterType the clusterType value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withClusterType(ClusterType clusterType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withClusterType(clusterType);
        return this;
    }

    /**
     * Get the clusterVersion property: The current runtime version of the cluster.
     *
     * @return the clusterVersion value.
     */
    public String clusterVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().clusterVersion();
    }

    /**
     * Set the clusterVersion property: The current runtime version of the cluster.
     *
     * @param clusterVersion the clusterVersion value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withClusterVersion(String clusterVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withClusterVersion(clusterVersion);
        return this;
    }

    /**
     * Get the computeDeploymentThreshold property: ValidationThreshold indicates allowed machine and node hardware and
     * deployment failures.
     *
     * <p>The validation threshold indicating the allowable failures of compute machines during environment validation
     * and deployment.
     *
     * @return the computeDeploymentThreshold value.
     */
    public ValidationThreshold computeDeploymentThreshold() {
        return this.innerProperties() == null ? null : this.innerProperties().computeDeploymentThreshold();
    }

    /**
     * Set the computeDeploymentThreshold property: ValidationThreshold indicates allowed machine and node hardware and
     * deployment failures.
     *
     * <p>The validation threshold indicating the allowable failures of compute machines during environment validation
     * and deployment.
     *
     * @param computeDeploymentThreshold the computeDeploymentThreshold value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withComputeDeploymentThreshold(ValidationThreshold computeDeploymentThreshold) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withComputeDeploymentThreshold(computeDeploymentThreshold);
        return this;
    }

    /**
     * Get the computeRackDefinitions property: The list of rack definitions for the compute racks in a multi-rack
     * cluster, or an empty list in a single-rack cluster.
     *
     * @return the computeRackDefinitions value.
     */
    public List<RackDefinition> computeRackDefinitions() {
        return this.innerProperties() == null ? null : this.innerProperties().computeRackDefinitions();
    }

    /**
     * Set the computeRackDefinitions property: The list of rack definitions for the compute racks in a multi-rack
     * cluster, or an empty list in a single-rack cluster.
     *
     * @param computeRackDefinitions the computeRackDefinitions value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withComputeRackDefinitions(List<RackDefinition> computeRackDefinitions) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withComputeRackDefinitions(computeRackDefinitions);
        return this;
    }

    /**
     * Get the detailedStatus property: The current detailed status of the cluster.
     *
     * @return the detailedStatus value.
     */
    public ClusterDetailedStatus detailedStatus() {
        return this.innerProperties() == null ? null : this.innerProperties().detailedStatus();
    }

    /**
     * Get the detailedStatusMessage property: The descriptive message about the detailed status.
     *
     * @return the detailedStatusMessage value.
     */
    public String detailedStatusMessage() {
        return this.innerProperties() == null ? null : this.innerProperties().detailedStatusMessage();
    }

    /**
     * Get the hybridAksExtendedLocation property: ExtendedLocation represents the Azure custom location where the
     * resource will be created.
     *
     * <p>Field Deprecated. This field will not be populated in an upcoming version. The extended location (custom
     * location) that represents the Hybrid AKS control plane location. This extended location is used when creating
     * provisioned clusters (Hybrid AKS clusters).
     *
     * @return the hybridAksExtendedLocation value.
     */
    public ExtendedLocation hybridAksExtendedLocation() {
        return this.innerProperties() == null ? null : this.innerProperties().hybridAksExtendedLocation();
    }

    /**
     * Get the managedResourceGroupConfiguration property: ManagedResourceGroupConfiguration represents the
     * configuration of the resource group managed by Azure.
     *
     * <p>The configuration of the managed resource group associated with the resource.
     *
     * @return the managedResourceGroupConfiguration value.
     */
    public ManagedResourceGroupConfiguration managedResourceGroupConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().managedResourceGroupConfiguration();
    }

    /**
     * Set the managedResourceGroupConfiguration property: ManagedResourceGroupConfiguration represents the
     * configuration of the resource group managed by Azure.
     *
     * <p>The configuration of the managed resource group associated with the resource.
     *
     * @param managedResourceGroupConfiguration the managedResourceGroupConfiguration value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withManagedResourceGroupConfiguration(
        ManagedResourceGroupConfiguration managedResourceGroupConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withManagedResourceGroupConfiguration(managedResourceGroupConfiguration);
        return this;
    }

    /**
     * Get the manualActionCount property: The count of Manual Action Taken (MAT) events that have not been validated.
     *
     * @return the manualActionCount value.
     */
    public Long manualActionCount() {
        return this.innerProperties() == null ? null : this.innerProperties().manualActionCount();
    }

    /**
     * Get the networkFabricId property: The resource ID of the Network Fabric associated with the cluster.
     *
     * @return the networkFabricId value.
     */
    public String networkFabricId() {
        return this.innerProperties() == null ? null : this.innerProperties().networkFabricId();
    }

    /**
     * Set the networkFabricId property: The resource ID of the Network Fabric associated with the cluster.
     *
     * @param networkFabricId the networkFabricId value to set.
     * @return the ClusterInner object itself.
     */
    public ClusterInner withNetworkFabricId(String networkFabricId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ClusterProperties();
        }
        this.innerProperties().withNetworkFabricId(networkFabricId);
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning state of the cluster.
     *
     * @return the provisioningState value.
     */
    public ClusterProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the supportExpiryDate property: The support end date of the runtime version of the cluster.
     *
     * @return the supportExpiryDate value.
     */
    public String supportExpiryDate() {
        return this.innerProperties() == null ? null : this.innerProperties().supportExpiryDate();
    }

    /**
     * Get the workloadResourceIds property: The list of workload resource IDs that are hosted within this cluster.
     *
     * @return the workloadResourceIds value.
     */
    public List<String> workloadResourceIds() {
        return this.innerProperties() == null ? null : this.innerProperties().workloadResourceIds();
    }

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

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