// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.batchai.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.annotation.JsonFlatten;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Cluster creation operation. */
@JsonFlatten
@Fluent
public class ClusterCreateParameters {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ClusterCreateParameters.class);

    /*
     * The size of the virtual machines in the cluster. All nodes in a cluster
     * have the same VM size. For information about available VM sizes for
     * clusters using images from the Virtual Machines Marketplace see Sizes
     * for Virtual Machines (Linux). Batch AI service supports all Azure VM
     * sizes except STANDARD_A0 and those with premium storage (STANDARD_GS,
     * STANDARD_DS, and STANDARD_DSV2 series).
     */
    @JsonProperty(value = "properties.vmSize")
    private String vmSize;

    /*
     * VM priority. Allowed values are: dedicated (default) and lowpriority.
     */
    @JsonProperty(value = "properties.vmPriority")
    private VmPriority vmPriority;

    /*
     * Scale settings for the cluster. Batch AI service supports manual and
     * auto scale clusters.
     */
    @JsonProperty(value = "properties.scaleSettings")
    private ScaleSettings scaleSettings;

    /*
     * OS image configuration for cluster nodes. All nodes in a cluster have
     * the same OS image.
     */
    @JsonProperty(value = "properties.virtualMachineConfiguration")
    private VirtualMachineConfiguration virtualMachineConfiguration;

    /*
     * Setup to be performed on each compute node in the cluster.
     */
    @JsonProperty(value = "properties.nodeSetup")
    private NodeSetup nodeSetup;

    /*
     * Settings for an administrator user account that will be created on each
     * compute node in the cluster.
     */
    @JsonProperty(value = "properties.userAccountSettings")
    private UserAccountSettings userAccountSettings;

    /*
     * Existing virtual network subnet to put the cluster nodes in. Note, if a
     * File Server mount configured in node setup, the File Server's subnet
     * will be used automatically.
     */
    @JsonProperty(value = "properties.subnet")
    private ResourceId subnet;

    /**
     * Get the vmSize property: The size of the virtual machines in the cluster. All nodes in a cluster have the same VM
     * size. For information about available VM sizes for clusters using images from the Virtual Machines Marketplace
     * see Sizes for Virtual Machines (Linux). Batch AI service supports all Azure VM sizes except STANDARD_A0 and those
     * with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series).
     *
     * @return the vmSize value.
     */
    public String vmSize() {
        return this.vmSize;
    }

    /**
     * Set the vmSize property: The size of the virtual machines in the cluster. All nodes in a cluster have the same VM
     * size. For information about available VM sizes for clusters using images from the Virtual Machines Marketplace
     * see Sizes for Virtual Machines (Linux). Batch AI service supports all Azure VM sizes except STANDARD_A0 and those
     * with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series).
     *
     * @param vmSize the vmSize value to set.
     * @return the ClusterCreateParameters object itself.
     */
    public ClusterCreateParameters withVmSize(String vmSize) {
        this.vmSize = vmSize;
        return this;
    }

    /**
     * Get the vmPriority property: VM priority. Allowed values are: dedicated (default) and lowpriority.
     *
     * @return the vmPriority value.
     */
    public VmPriority vmPriority() {
        return this.vmPriority;
    }

    /**
     * Set the vmPriority property: VM priority. Allowed values are: dedicated (default) and lowpriority.
     *
     * @param vmPriority the vmPriority value to set.
     * @return the ClusterCreateParameters object itself.
     */
    public ClusterCreateParameters withVmPriority(VmPriority vmPriority) {
        this.vmPriority = vmPriority;
        return this;
    }

    /**
     * Get the scaleSettings property: Scale settings for the cluster. Batch AI service supports manual and auto scale
     * clusters.
     *
     * @return the scaleSettings value.
     */
    public ScaleSettings scaleSettings() {
        return this.scaleSettings;
    }

    /**
     * Set the scaleSettings property: Scale settings for the cluster. Batch AI service supports manual and auto scale
     * clusters.
     *
     * @param scaleSettings the scaleSettings value to set.
     * @return the ClusterCreateParameters object itself.
     */
    public ClusterCreateParameters withScaleSettings(ScaleSettings scaleSettings) {
        this.scaleSettings = scaleSettings;
        return this;
    }

    /**
     * Get the virtualMachineConfiguration property: OS image configuration for cluster nodes. All nodes in a cluster
     * have the same OS image.
     *
     * @return the virtualMachineConfiguration value.
     */
    public VirtualMachineConfiguration virtualMachineConfiguration() {
        return this.virtualMachineConfiguration;
    }

    /**
     * Set the virtualMachineConfiguration property: OS image configuration for cluster nodes. All nodes in a cluster
     * have the same OS image.
     *
     * @param virtualMachineConfiguration the virtualMachineConfiguration value to set.
     * @return the ClusterCreateParameters object itself.
     */
    public ClusterCreateParameters withVirtualMachineConfiguration(
        VirtualMachineConfiguration virtualMachineConfiguration) {
        this.virtualMachineConfiguration = virtualMachineConfiguration;
        return this;
    }

    /**
     * Get the nodeSetup property: Setup to be performed on each compute node in the cluster.
     *
     * @return the nodeSetup value.
     */
    public NodeSetup nodeSetup() {
        return this.nodeSetup;
    }

    /**
     * Set the nodeSetup property: Setup to be performed on each compute node in the cluster.
     *
     * @param nodeSetup the nodeSetup value to set.
     * @return the ClusterCreateParameters object itself.
     */
    public ClusterCreateParameters withNodeSetup(NodeSetup nodeSetup) {
        this.nodeSetup = nodeSetup;
        return this;
    }

    /**
     * Get the userAccountSettings property: Settings for an administrator user account that will be created on each
     * compute node in the cluster.
     *
     * @return the userAccountSettings value.
     */
    public UserAccountSettings userAccountSettings() {
        return this.userAccountSettings;
    }

    /**
     * Set the userAccountSettings property: Settings for an administrator user account that will be created on each
     * compute node in the cluster.
     *
     * @param userAccountSettings the userAccountSettings value to set.
     * @return the ClusterCreateParameters object itself.
     */
    public ClusterCreateParameters withUserAccountSettings(UserAccountSettings userAccountSettings) {
        this.userAccountSettings = userAccountSettings;
        return this;
    }

    /**
     * Get the subnet property: Existing virtual network subnet to put the cluster nodes in. Note, if a File Server
     * mount configured in node setup, the File Server's subnet will be used automatically.
     *
     * @return the subnet value.
     */
    public ResourceId subnet() {
        return this.subnet;
    }

    /**
     * Set the subnet property: Existing virtual network subnet to put the cluster nodes in. Note, if a File Server
     * mount configured in node setup, the File Server's subnet will be used automatically.
     *
     * @param subnet the subnet value to set.
     * @return the ClusterCreateParameters object itself.
     */
    public ClusterCreateParameters withSubnet(ResourceId subnet) {
        this.subnet = subnet;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (scaleSettings() != null) {
            scaleSettings().validate();
        }
        if (virtualMachineConfiguration() != null) {
            virtualMachineConfiguration().validate();
        }
        if (nodeSetup() != null) {
            nodeSetup().validate();
        }
        if (userAccountSettings() != null) {
            userAccountSettings().validate();
        }
        if (subnet() != null) {
            subnet().validate();
        }
    }
}
