// 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;
import java.util.List;

/**
 * ControlPlaneNodeConfiguration represents the selection of virtual machines and size of the control plane for a
 * Kubernetes cluster.
 */
@Fluent
public final class ControlPlaneNodeConfiguration {
    /*
     * AdministratorConfiguration represents the administrative credentials that will be applied to the control plane
     * and agent pool nodes in Kubernetes clusters.
     *
     * The administrator credentials to be used for the nodes in the control plane.
     */
    @JsonProperty(value = "administratorConfiguration")
    private AdministratorConfiguration administratorConfiguration;

    /*
     * The list of availability zones of the Network Cloud cluster to be used for the provisioning of nodes in the
     * control plane. If not specified, all availability zones will be used.
     */
    @JsonProperty(value = "availabilityZones")
    private List<String> availabilityZones;

    /*
     * The number of virtual machines that use this configuration.
     */
    @JsonProperty(value = "count", required = true)
    private long count;

    /*
     * The name of the VM SKU supplied during creation.
     */
    @JsonProperty(value = "vmSkuName", required = true)
    private String vmSkuName;

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

    /**
     * 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 administrator credentials to be used for the nodes in the control plane.
     *
     * @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 administrator credentials to be used for the nodes in the control plane.
     *
     * @param administratorConfiguration the administratorConfiguration value to set.
     * @return the ControlPlaneNodeConfiguration object itself.
     */
    public ControlPlaneNodeConfiguration withAdministratorConfiguration(
        AdministratorConfiguration administratorConfiguration) {
        this.administratorConfiguration = administratorConfiguration;
        return this;
    }

    /**
     * Get the availabilityZones property: The list of availability zones of the Network Cloud cluster to be used for
     * the provisioning of nodes in the control plane. If not specified, all availability zones will be used.
     *
     * @return the availabilityZones value.
     */
    public List<String> availabilityZones() {
        return this.availabilityZones;
    }

    /**
     * Set the availabilityZones property: The list of availability zones of the Network Cloud cluster to be used for
     * the provisioning of nodes in the control plane. If not specified, all availability zones will be used.
     *
     * @param availabilityZones the availabilityZones value to set.
     * @return the ControlPlaneNodeConfiguration object itself.
     */
    public ControlPlaneNodeConfiguration withAvailabilityZones(List<String> availabilityZones) {
        this.availabilityZones = availabilityZones;
        return this;
    }

    /**
     * Get the count property: The number of virtual machines that use this configuration.
     *
     * @return the count value.
     */
    public long count() {
        return this.count;
    }

    /**
     * Set the count property: The number of virtual machines that use this configuration.
     *
     * @param count the count value to set.
     * @return the ControlPlaneNodeConfiguration object itself.
     */
    public ControlPlaneNodeConfiguration withCount(long count) {
        this.count = count;
        return this;
    }

    /**
     * Get the vmSkuName property: The name of the VM SKU supplied during creation.
     *
     * @return the vmSkuName value.
     */
    public String vmSkuName() {
        return this.vmSkuName;
    }

    /**
     * Set the vmSkuName property: The name of the VM SKU supplied during creation.
     *
     * @param vmSkuName the vmSkuName value to set.
     * @return the ControlPlaneNodeConfiguration object itself.
     */
    public ControlPlaneNodeConfiguration withVmSkuName(String vmSkuName) {
        this.vmSkuName = vmSkuName;
        return this;
    }

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

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