// 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.util.logging.ClientLogger;
import com.azure.resourcemanager.networkcloud.models.AadConfiguration;
import com.azure.resourcemanager.networkcloud.models.AdministratorConfiguration;
import com.azure.resourcemanager.networkcloud.models.AvailableUpgrade;
import com.azure.resourcemanager.networkcloud.models.ControlPlaneNodeConfiguration;
import com.azure.resourcemanager.networkcloud.models.FeatureStatus;
import com.azure.resourcemanager.networkcloud.models.InitialAgentPoolConfiguration;
import com.azure.resourcemanager.networkcloud.models.KubernetesClusterDetailedStatus;
import com.azure.resourcemanager.networkcloud.models.KubernetesClusterNode;
import com.azure.resourcemanager.networkcloud.models.KubernetesClusterProvisioningState;
import com.azure.resourcemanager.networkcloud.models.ManagedResourceGroupConfiguration;
import com.azure.resourcemanager.networkcloud.models.NetworkConfiguration;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** KubernetesClusterProperties represents the properties of Kubernetes cluster resource. */
@Fluent
public final class KubernetesClusterProperties {
    /*
     * AadConfiguration represents the Azure Active Directory Integration properties.
     *
     * The Azure Active Directory Integration properties.
     */
    @JsonProperty(value = "aadConfiguration")
    private AadConfiguration aadConfiguration;

    /*
     * AdministratorConfiguration represents the administrative credentials that will be applied to the control plane
     * and agent pool nodes in Kubernetes clusters.
     *
     * The administrative credentials that will be applied to the control plane and agent pool nodes that do not
     * specify their own values.
     */
    @JsonProperty(value = "administratorConfiguration")
    private AdministratorConfiguration administratorConfiguration;

    /*
     * The full list of network resource IDs that are attached to this cluster, including those attached only to
     * specific agent pools.
     */
    @JsonProperty(value = "attachedNetworkIds", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> attachedNetworkIds;

    /*
     * The list of versions that this Kubernetes cluster can be upgraded to.
     */
    @JsonProperty(value = "availableUpgrades", access = JsonProperty.Access.WRITE_ONLY)
    private List<AvailableUpgrade> availableUpgrades;

    /*
     * The resource ID of the Network Cloud cluster.
     */
    @JsonProperty(value = "clusterId", access = JsonProperty.Access.WRITE_ONLY)
    private String clusterId;

    /*
     * The resource ID of the connected cluster set up when this Kubernetes cluster is created.
     */
    @JsonProperty(value = "connectedClusterId", access = JsonProperty.Access.WRITE_ONLY)
    private String connectedClusterId;

    /*
     * The current running version of Kubernetes on the control plane.
     */
    @JsonProperty(value = "controlPlaneKubernetesVersion", access = JsonProperty.Access.WRITE_ONLY)
    private String controlPlaneKubernetesVersion;

    /*
     * ControlPlaneNodeConfiguration represents the selection of virtual machines and size of the control plane for a
     * Kubernetes cluster.
     *
     * The defining characteristics of the control plane for this Kubernetes Cluster.
     */
    @JsonProperty(value = "controlPlaneNodeConfiguration", required = true)
    private ControlPlaneNodeConfiguration controlPlaneNodeConfiguration;

    /*
     * The current status of the Kubernetes cluster.
     */
    @JsonProperty(value = "detailedStatus", access = JsonProperty.Access.WRITE_ONLY)
    private KubernetesClusterDetailedStatus detailedStatus;

    /*
     * The descriptive message about the current detailed status.
     */
    @JsonProperty(value = "detailedStatusMessage", access = JsonProperty.Access.WRITE_ONLY)
    private String detailedStatusMessage;

    /*
     * The current feature settings.
     */
    @JsonProperty(value = "featureStatuses", access = JsonProperty.Access.WRITE_ONLY)
    private List<FeatureStatus> featureStatuses;

    /*
     * The agent pools that are created with this Kubernetes cluster for running critical system services and
     * workloads. This data in this field is only used during creation, and the field will be empty following the
     * creation of the Kubernetes Cluster. After creation, the management of agent pools is done using the agentPools
     * sub-resource.
     */
    @JsonProperty(value = "initialAgentPoolConfigurations", required = true)
    private List<InitialAgentPoolConfiguration> initialAgentPoolConfigurations;

    /*
     * The Kubernetes version for this cluster. Accepts n.n, n.n.n, and n.n.n-n format. The interpreted version used
     * will be resolved into this field after creation or update.
     */
    @JsonProperty(value = "kubernetesVersion", required = true)
    private String kubernetesVersion;

    /*
     * ManagedResourceGroupConfiguration represents the configuration of the resource group managed by Azure.
     *
     * The configuration of the managed resource group associated with the resource.
     */
    @JsonProperty(value = "managedResourceGroupConfiguration")
    private ManagedResourceGroupConfiguration managedResourceGroupConfiguration;

    /*
     * NetworkConfiguration specifies the Kubernetes cluster network related configuration.
     *
     * The configuration of the Kubernetes cluster networking, including the attachment of networks that span the
     * cluster.
     */
    @JsonProperty(value = "networkConfiguration", required = true)
    private NetworkConfiguration networkConfiguration;

    /*
     * The details of the nodes in this cluster.
     */
    @JsonProperty(value = "nodes", access = JsonProperty.Access.WRITE_ONLY)
    private List<KubernetesClusterNode> nodes;

    /*
     * The provisioning state of the Kubernetes cluster resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private KubernetesClusterProvisioningState provisioningState;

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

    /**
     * Get the aadConfiguration property: AadConfiguration represents the Azure Active Directory Integration properties.
     *
     * <p>The Azure Active Directory Integration properties.
     *
     * @return the aadConfiguration value.
     */
    public AadConfiguration aadConfiguration() {
        return this.aadConfiguration;
    }

    /**
     * Set the aadConfiguration property: AadConfiguration represents the Azure Active Directory Integration properties.
     *
     * <p>The Azure Active Directory Integration properties.
     *
     * @param aadConfiguration the aadConfiguration value to set.
     * @return the KubernetesClusterProperties object itself.
     */
    public KubernetesClusterProperties withAadConfiguration(AadConfiguration aadConfiguration) {
        this.aadConfiguration = aadConfiguration;
        return this;
    }

    /**
     * Get the administratorConfiguration property: AdministratorConfiguration represents the administrative credentials
     * that will be applied to the control plane and agent pool nodes in Kubernetes clusters.
     *
     * <p>The administrative credentials that will be applied to the control plane and agent pool nodes that do not
     * specify their own values.
     *
     * @return the administratorConfiguration value.
     */
    public AdministratorConfiguration administratorConfiguration() {
        return this.administratorConfiguration;
    }

    /**
     * Set the administratorConfiguration property: AdministratorConfiguration represents the administrative credentials
     * that will be applied to the control plane and agent pool nodes in Kubernetes clusters.
     *
     * <p>The administrative credentials that will be applied to the control plane and agent pool nodes that do not
     * specify their own values.
     *
     * @param administratorConfiguration the administratorConfiguration value to set.
     * @return the KubernetesClusterProperties object itself.
     */
    public KubernetesClusterProperties withAdministratorConfiguration(
        AdministratorConfiguration administratorConfiguration) {
        this.administratorConfiguration = administratorConfiguration;
        return this;
    }

    /**
     * Get the attachedNetworkIds property: The full list of network resource IDs that are attached to this cluster,
     * including those attached only to specific agent pools.
     *
     * @return the attachedNetworkIds value.
     */
    public List<String> attachedNetworkIds() {
        return this.attachedNetworkIds;
    }

    /**
     * Get the availableUpgrades property: The list of versions that this Kubernetes cluster can be upgraded to.
     *
     * @return the availableUpgrades value.
     */
    public List<AvailableUpgrade> availableUpgrades() {
        return this.availableUpgrades;
    }

    /**
     * Get the clusterId property: The resource ID of the Network Cloud cluster.
     *
     * @return the clusterId value.
     */
    public String clusterId() {
        return this.clusterId;
    }

    /**
     * Get the connectedClusterId property: The resource ID of the connected cluster set up when this Kubernetes cluster
     * is created.
     *
     * @return the connectedClusterId value.
     */
    public String connectedClusterId() {
        return this.connectedClusterId;
    }

    /**
     * Get the controlPlaneKubernetesVersion property: The current running version of Kubernetes on the control plane.
     *
     * @return the controlPlaneKubernetesVersion value.
     */
    public String controlPlaneKubernetesVersion() {
        return this.controlPlaneKubernetesVersion;
    }

    /**
     * Get the controlPlaneNodeConfiguration property: ControlPlaneNodeConfiguration represents the selection of virtual
     * machines and size of the control plane for a Kubernetes cluster.
     *
     * <p>The defining characteristics of the control plane for this Kubernetes Cluster.
     *
     * @return the controlPlaneNodeConfiguration value.
     */
    public ControlPlaneNodeConfiguration controlPlaneNodeConfiguration() {
        return this.controlPlaneNodeConfiguration;
    }

    /**
     * Set the controlPlaneNodeConfiguration property: ControlPlaneNodeConfiguration represents the selection of virtual
     * machines and size of the control plane for a Kubernetes cluster.
     *
     * <p>The defining characteristics of the control plane for this Kubernetes Cluster.
     *
     * @param controlPlaneNodeConfiguration the controlPlaneNodeConfiguration value to set.
     * @return the KubernetesClusterProperties object itself.
     */
    public KubernetesClusterProperties withControlPlaneNodeConfiguration(
        ControlPlaneNodeConfiguration controlPlaneNodeConfiguration) {
        this.controlPlaneNodeConfiguration = controlPlaneNodeConfiguration;
        return this;
    }

    /**
     * Get the detailedStatus property: The current status of the Kubernetes cluster.
     *
     * @return the detailedStatus value.
     */
    public KubernetesClusterDetailedStatus detailedStatus() {
        return this.detailedStatus;
    }

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

    /**
     * Get the featureStatuses property: The current feature settings.
     *
     * @return the featureStatuses value.
     */
    public List<FeatureStatus> featureStatuses() {
        return this.featureStatuses;
    }

    /**
     * Get the initialAgentPoolConfigurations property: The agent pools that are created with this Kubernetes cluster
     * for running critical system services and workloads. This data in this field is only used during creation, and the
     * field will be empty following the creation of the Kubernetes Cluster. After creation, the management of agent
     * pools is done using the agentPools sub-resource.
     *
     * @return the initialAgentPoolConfigurations value.
     */
    public List<InitialAgentPoolConfiguration> initialAgentPoolConfigurations() {
        return this.initialAgentPoolConfigurations;
    }

    /**
     * Set the initialAgentPoolConfigurations property: The agent pools that are created with this Kubernetes cluster
     * for running critical system services and workloads. This data in this field is only used during creation, and the
     * field will be empty following the creation of the Kubernetes Cluster. After creation, the management of agent
     * pools is done using the agentPools sub-resource.
     *
     * @param initialAgentPoolConfigurations the initialAgentPoolConfigurations value to set.
     * @return the KubernetesClusterProperties object itself.
     */
    public KubernetesClusterProperties withInitialAgentPoolConfigurations(
        List<InitialAgentPoolConfiguration> initialAgentPoolConfigurations) {
        this.initialAgentPoolConfigurations = initialAgentPoolConfigurations;
        return this;
    }

    /**
     * Get the kubernetesVersion property: The Kubernetes version for this cluster. Accepts n.n, n.n.n, and n.n.n-n
     * format. The interpreted version used will be resolved into this field after creation or update.
     *
     * @return the kubernetesVersion value.
     */
    public String kubernetesVersion() {
        return this.kubernetesVersion;
    }

    /**
     * Set the kubernetesVersion property: The Kubernetes version for this cluster. Accepts n.n, n.n.n, and n.n.n-n
     * format. The interpreted version used will be resolved into this field after creation or update.
     *
     * @param kubernetesVersion the kubernetesVersion value to set.
     * @return the KubernetesClusterProperties object itself.
     */
    public KubernetesClusterProperties withKubernetesVersion(String kubernetesVersion) {
        this.kubernetesVersion = kubernetesVersion;
        return this;
    }

    /**
     * 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.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 KubernetesClusterProperties object itself.
     */
    public KubernetesClusterProperties withManagedResourceGroupConfiguration(
        ManagedResourceGroupConfiguration managedResourceGroupConfiguration) {
        this.managedResourceGroupConfiguration = managedResourceGroupConfiguration;
        return this;
    }

    /**
     * Get the networkConfiguration property: NetworkConfiguration specifies the Kubernetes cluster network related
     * configuration.
     *
     * <p>The configuration of the Kubernetes cluster networking, including the attachment of networks that span the
     * cluster.
     *
     * @return the networkConfiguration value.
     */
    public NetworkConfiguration networkConfiguration() {
        return this.networkConfiguration;
    }

    /**
     * Set the networkConfiguration property: NetworkConfiguration specifies the Kubernetes cluster network related
     * configuration.
     *
     * <p>The configuration of the Kubernetes cluster networking, including the attachment of networks that span the
     * cluster.
     *
     * @param networkConfiguration the networkConfiguration value to set.
     * @return the KubernetesClusterProperties object itself.
     */
    public KubernetesClusterProperties withNetworkConfiguration(NetworkConfiguration networkConfiguration) {
        this.networkConfiguration = networkConfiguration;
        return this;
    }

    /**
     * Get the nodes property: The details of the nodes in this cluster.
     *
     * @return the nodes value.
     */
    public List<KubernetesClusterNode> nodes() {
        return this.nodes;
    }

    /**
     * Get the provisioningState property: The provisioning state of the Kubernetes cluster resource.
     *
     * @return the provisioningState value.
     */
    public KubernetesClusterProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (aadConfiguration() != null) {
            aadConfiguration().validate();
        }
        if (administratorConfiguration() != null) {
            administratorConfiguration().validate();
        }
        if (availableUpgrades() != null) {
            availableUpgrades().forEach(e -> e.validate());
        }
        if (controlPlaneNodeConfiguration() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property controlPlaneNodeConfiguration in model"
                            + " KubernetesClusterProperties"));
        } else {
            controlPlaneNodeConfiguration().validate();
        }
        if (featureStatuses() != null) {
            featureStatuses().forEach(e -> e.validate());
        }
        if (initialAgentPoolConfigurations() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property initialAgentPoolConfigurations in model"
                            + " KubernetesClusterProperties"));
        } else {
            initialAgentPoolConfigurations().forEach(e -> e.validate());
        }
        if (kubernetesVersion() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property kubernetesVersion in model KubernetesClusterProperties"));
        }
        if (managedResourceGroupConfiguration() != null) {
            managedResourceGroupConfiguration().validate();
        }
        if (networkConfiguration() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property networkConfiguration in model KubernetesClusterProperties"));
        } else {
            networkConfiguration().validate();
        }
        if (nodes() != null) {
            nodes().forEach(e -> e.validate());
        }
    }

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