// 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;

/**
 * InitialAgentPoolConfiguration specifies the configuration of a pool of virtual machines that are initially defined
 * with a Kubernetes cluster.
 */
@Fluent
public final class InitialAgentPoolConfiguration {
    /*
     * 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 this agent pool.
     */
    @JsonProperty(value = "administratorConfiguration")
    private AdministratorConfiguration administratorConfiguration;

    /*
     * AgentOptions are configurations that will be applied to each agent in an agent pool.
     *
     * The configurations that will be applied to each agent in this agent pool.
     */
    @JsonProperty(value = "agentOptions")
    private AgentOptions agentOptions;

    /*
     * AttachedNetworkConfiguration represents the set of workload networks to attach to a resource.
     *
     * The configuration of networks being attached to the agent pool for use by the workloads that run on this
     * Kubernetes cluster.
     */
    @JsonProperty(value = "attachedNetworkConfiguration")
    private AttachedNetworkConfiguration attachedNetworkConfiguration;

    /*
     * The list of availability zones of the Network Cloud cluster used for the provisioning of nodes in this agent
     * pool. 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 labels applied to the nodes in this agent pool.
     */
    @JsonProperty(value = "labels")
    private List<KubernetesLabel> labels;

    /*
     * The selection of how this agent pool is utilized, either as a system pool or a user pool. System pools run the
     * features and critical services for the Kubernetes Cluster, while user pools are dedicated to user workloads.
     * Every Kubernetes cluster must contain at least one system node pool with at least one node.
     */
    @JsonProperty(value = "mode", required = true)
    private AgentPoolMode mode;

    /*
     * The name that will be used for the agent pool resource representing this agent pool.
     */
    @JsonProperty(value = "name", required = true)
    private String name;

    /*
     * The taints applied to the nodes in this agent pool.
     */
    @JsonProperty(value = "taints")
    private List<KubernetesLabel> taints;

    /*
     * AgentPoolUpgradeSettings specifies the upgrade settings for an agent pool.
     *
     * The configuration of the agent pool.
     */
    @JsonProperty(value = "upgradeSettings")
    private AgentPoolUpgradeSettings upgradeSettings;

    /*
     * The name of the VM SKU that determines the size of resources allocated for node VMs.
     */
    @JsonProperty(value = "vmSkuName", required = true)
    private String vmSkuName;

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

    /**
     * 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 this agent pool.
     *
     * @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 this agent pool.
     *
     * @param administratorConfiguration the administratorConfiguration value to set.
     * @return the InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration withAdministratorConfiguration(
        AdministratorConfiguration administratorConfiguration) {
        this.administratorConfiguration = administratorConfiguration;
        return this;
    }

    /**
     * Get the agentOptions property: AgentOptions are configurations that will be applied to each agent in an agent
     * pool.
     *
     * <p>The configurations that will be applied to each agent in this agent pool.
     *
     * @return the agentOptions value.
     */
    public AgentOptions agentOptions() {
        return this.agentOptions;
    }

    /**
     * Set the agentOptions property: AgentOptions are configurations that will be applied to each agent in an agent
     * pool.
     *
     * <p>The configurations that will be applied to each agent in this agent pool.
     *
     * @param agentOptions the agentOptions value to set.
     * @return the InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration withAgentOptions(AgentOptions agentOptions) {
        this.agentOptions = agentOptions;
        return this;
    }

    /**
     * Get the attachedNetworkConfiguration property: AttachedNetworkConfiguration represents the set of workload
     * networks to attach to a resource.
     *
     * <p>The configuration of networks being attached to the agent pool for use by the workloads that run on this
     * Kubernetes cluster.
     *
     * @return the attachedNetworkConfiguration value.
     */
    public AttachedNetworkConfiguration attachedNetworkConfiguration() {
        return this.attachedNetworkConfiguration;
    }

    /**
     * Set the attachedNetworkConfiguration property: AttachedNetworkConfiguration represents the set of workload
     * networks to attach to a resource.
     *
     * <p>The configuration of networks being attached to the agent pool for use by the workloads that run on this
     * Kubernetes cluster.
     *
     * @param attachedNetworkConfiguration the attachedNetworkConfiguration value to set.
     * @return the InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration withAttachedNetworkConfiguration(
        AttachedNetworkConfiguration attachedNetworkConfiguration) {
        this.attachedNetworkConfiguration = attachedNetworkConfiguration;
        return this;
    }

    /**
     * Get the availabilityZones property: The list of availability zones of the Network Cloud cluster used for the
     * provisioning of nodes in this agent pool. 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 used for the
     * provisioning of nodes in this agent pool. If not specified, all availability zones will be used.
     *
     * @param availabilityZones the availabilityZones value to set.
     * @return the InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration 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 InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration withCount(long count) {
        this.count = count;
        return this;
    }

    /**
     * Get the labels property: The labels applied to the nodes in this agent pool.
     *
     * @return the labels value.
     */
    public List<KubernetesLabel> labels() {
        return this.labels;
    }

    /**
     * Set the labels property: The labels applied to the nodes in this agent pool.
     *
     * @param labels the labels value to set.
     * @return the InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration withLabels(List<KubernetesLabel> labels) {
        this.labels = labels;
        return this;
    }

    /**
     * Get the mode property: The selection of how this agent pool is utilized, either as a system pool or a user pool.
     * System pools run the features and critical services for the Kubernetes Cluster, while user pools are dedicated to
     * user workloads. Every Kubernetes cluster must contain at least one system node pool with at least one node.
     *
     * @return the mode value.
     */
    public AgentPoolMode mode() {
        return this.mode;
    }

    /**
     * Set the mode property: The selection of how this agent pool is utilized, either as a system pool or a user pool.
     * System pools run the features and critical services for the Kubernetes Cluster, while user pools are dedicated to
     * user workloads. Every Kubernetes cluster must contain at least one system node pool with at least one node.
     *
     * @param mode the mode value to set.
     * @return the InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration withMode(AgentPoolMode mode) {
        this.mode = mode;
        return this;
    }

    /**
     * Get the name property: The name that will be used for the agent pool resource representing this agent pool.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: The name that will be used for the agent pool resource representing this agent pool.
     *
     * @param name the name value to set.
     * @return the InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the taints property: The taints applied to the nodes in this agent pool.
     *
     * @return the taints value.
     */
    public List<KubernetesLabel> taints() {
        return this.taints;
    }

    /**
     * Set the taints property: The taints applied to the nodes in this agent pool.
     *
     * @param taints the taints value to set.
     * @return the InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration withTaints(List<KubernetesLabel> taints) {
        this.taints = taints;
        return this;
    }

    /**
     * Get the upgradeSettings property: AgentPoolUpgradeSettings specifies the upgrade settings for an agent pool.
     *
     * <p>The configuration of the agent pool.
     *
     * @return the upgradeSettings value.
     */
    public AgentPoolUpgradeSettings upgradeSettings() {
        return this.upgradeSettings;
    }

    /**
     * Set the upgradeSettings property: AgentPoolUpgradeSettings specifies the upgrade settings for an agent pool.
     *
     * <p>The configuration of the agent pool.
     *
     * @param upgradeSettings the upgradeSettings value to set.
     * @return the InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration withUpgradeSettings(AgentPoolUpgradeSettings upgradeSettings) {
        this.upgradeSettings = upgradeSettings;
        return this;
    }

    /**
     * Get the vmSkuName property: The name of the VM SKU that determines the size of resources allocated for node VMs.
     *
     * @return the vmSkuName value.
     */
    public String vmSkuName() {
        return this.vmSkuName;
    }

    /**
     * Set the vmSkuName property: The name of the VM SKU that determines the size of resources allocated for node VMs.
     *
     * @param vmSkuName the vmSkuName value to set.
     * @return the InitialAgentPoolConfiguration object itself.
     */
    public InitialAgentPoolConfiguration 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 (agentOptions() != null) {
            agentOptions().validate();
        }
        if (attachedNetworkConfiguration() != null) {
            attachedNetworkConfiguration().validate();
        }
        if (labels() != null) {
            labels().forEach(e -> e.validate());
        }
        if (mode() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property mode in model InitialAgentPoolConfiguration"));
        }
        if (name() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property name in model InitialAgentPoolConfiguration"));
        }
        if (taints() != null) {
            taints().forEach(e -> e.validate());
        }
        if (upgradeSettings() != null) {
            upgradeSettings().validate();
        }
        if (vmSkuName() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property vmSkuName in model InitialAgentPoolConfiguration"));
        }
    }

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