// 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.AdministratorConfiguration;
import com.azure.resourcemanager.networkcloud.models.AgentOptions;
import com.azure.resourcemanager.networkcloud.models.AgentPoolDetailedStatus;
import com.azure.resourcemanager.networkcloud.models.AgentPoolMode;
import com.azure.resourcemanager.networkcloud.models.AgentPoolProvisioningState;
import com.azure.resourcemanager.networkcloud.models.AgentPoolUpgradeSettings;
import com.azure.resourcemanager.networkcloud.models.AttachedNetworkConfiguration;
import com.azure.resourcemanager.networkcloud.models.ExtendedLocation;
import com.azure.resourcemanager.networkcloud.models.KubernetesLabel;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** AgentPool represents the agent pool of Kubernetes cluster. */
@Fluent
public final class AgentPoolInner extends Resource {
    /*
     * ExtendedLocation represents the Azure custom location where the resource will be created.
     *
     * The extended location of the cluster associated with the resource.
     */
    @JsonProperty(value = "extendedLocation")
    private ExtendedLocation extendedLocation;

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

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

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

    /**
     * Get the extendedLocation property: ExtendedLocation represents the Azure custom location where the resource will
     * be created.
     *
     * <p>The extended location of the cluster associated with the resource.
     *
     * @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 associated with the resource.
     *
     * @param extendedLocation the extendedLocation value to set.
     * @return the AgentPoolInner object itself.
     */
    public AgentPoolInner withExtendedLocation(ExtendedLocation extendedLocation) {
        this.extendedLocation = extendedLocation;
        return this;
    }

    /**
     * Get the innerProperties property: AgentPoolProperties represents the properties of the Kubernetes cluster agent
     * pool.
     *
     * <p>The list of the resource properties.
     *
     * @return the innerProperties value.
     */
    private AgentPoolProperties 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 AgentPoolInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AgentPoolInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        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 administrator credentials to be used for the nodes in this agent pool.
     *
     * @return the administratorConfiguration value.
     */
    public AdministratorConfiguration administratorConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().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 AgentPoolInner object itself.
     */
    public AgentPoolInner withAdministratorConfiguration(AdministratorConfiguration administratorConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AgentPoolProperties();
        }
        this.innerProperties().withAdministratorConfiguration(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.innerProperties() == null ? null : this.innerProperties().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 AgentPoolInner object itself.
     */
    public AgentPoolInner withAgentOptions(AgentOptions agentOptions) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AgentPoolProperties();
        }
        this.innerProperties().withAgentOptions(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.innerProperties() == null ? null : this.innerProperties().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 AgentPoolInner object itself.
     */
    public AgentPoolInner withAttachedNetworkConfiguration(AttachedNetworkConfiguration attachedNetworkConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AgentPoolProperties();
        }
        this.innerProperties().withAttachedNetworkConfiguration(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.innerProperties() == null ? null : this.innerProperties().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 AgentPoolInner object itself.
     */
    public AgentPoolInner withAvailabilityZones(List<String> availabilityZones) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AgentPoolProperties();
        }
        this.innerProperties().withAvailabilityZones(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.innerProperties() == null ? 0L : this.innerProperties().count();
    }

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

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

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

    /**
     * Get the kubernetesVersion property: The Kubernetes version running in this agent pool.
     *
     * @return the kubernetesVersion value.
     */
    public String kubernetesVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().kubernetesVersion();
    }

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

    /**
     * Set the labels property: The labels applied to the nodes in this agent pool.
     *
     * @param labels the labels value to set.
     * @return the AgentPoolInner object itself.
     */
    public AgentPoolInner withLabels(List<KubernetesLabel> labels) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AgentPoolProperties();
        }
        this.innerProperties().withLabels(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.innerProperties() == null ? null : this.innerProperties().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 AgentPoolInner object itself.
     */
    public AgentPoolInner withMode(AgentPoolMode mode) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AgentPoolProperties();
        }
        this.innerProperties().withMode(mode);
        return this;
    }

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

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

    /**
     * Set the taints property: The taints applied to the nodes in this agent pool.
     *
     * @param taints the taints value to set.
     * @return the AgentPoolInner object itself.
     */
    public AgentPoolInner withTaints(List<KubernetesLabel> taints) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AgentPoolProperties();
        }
        this.innerProperties().withTaints(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.innerProperties() == null ? null : this.innerProperties().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 AgentPoolInner object itself.
     */
    public AgentPoolInner withUpgradeSettings(AgentPoolUpgradeSettings upgradeSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AgentPoolProperties();
        }
        this.innerProperties().withUpgradeSettings(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.innerProperties() == null ? null : this.innerProperties().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 AgentPoolInner object itself.
     */
    public AgentPoolInner withVmSkuName(String vmSkuName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AgentPoolProperties();
        }
        this.innerProperties().withVmSkuName(vmSkuName);
        return this;
    }

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

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