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

package com.azure.resourcemanager.workloads.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** The resource names object for virtual machine and related resources. */
@Fluent
public final class VirtualMachineResourceNames {
    /*
     * The full name for virtual machine. The length of this field can be upto 64 characters. If name is not provided,
     * service uses a default name based on the deployment type. For SingleServer, default name is {SID}vm. In case of
     * HA-AvZone systems, default name will be {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of
     * more than 1 vm per layer. For distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with
     * an incrementor at the end in case of more than 1 vm per layer.
     */
    @JsonProperty(value = "vmName")
    private String vmName;

    /*
     * The full name for virtual-machine's host (computer name). Currently, ACSS only supports host names which are
     * less than or equal to 13 characters long. If this value is not provided, vmName will be used as host name.
     */
    @JsonProperty(value = "hostName")
    private String hostname;

    /*
     * The list of network interface name objects for the selected virtual machine. Currently, only one network
     * interface is supported per virtual machine.
     */
    @JsonProperty(value = "networkInterfaces")
    private List<NetworkInterfaceResourceNames> networkInterfaces;

    /*
     * The full name for OS disk attached to the VM. If this value is not provided, it will be named by ARM as per its
     * default naming standards (prefixed with vm name). There is only one OS disk attached per Virtual Machine.
     */
    @JsonProperty(value = "osDiskName")
    private String osDiskName;

    /*
     * The full resource names for virtual machine data disks. This is a dictionary containing list of names of data
     * disks per volume. Currently supported volumes for database layer are ['hana/data', 'hana/log', hana/shared',
     * 'usr/sap', 'os', 'backup']. For application and cs layers, only 'default' volume is supported
     */
    @JsonProperty(value = "dataDiskNames")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, List<String>> dataDiskNames;

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

    /**
     * Get the vmName property: The full name for virtual machine. The length of this field can be upto 64 characters.
     * If name is not provided, service uses a default name based on the deployment type. For SingleServer, default name
     * is {SID}vm. In case of HA-AvZone systems, default name will be {SID}{app/ascs/db}z{a/b}vm with an incrementor at
     * the end in case of more than 1 vm per layer. For distributed and HA-AvSet systems, default name will be
     * {SID}{app/ascs/db}vm with an incrementor at the end in case of more than 1 vm per layer.
     *
     * @return the vmName value.
     */
    public String vmName() {
        return this.vmName;
    }

    /**
     * Set the vmName property: The full name for virtual machine. The length of this field can be upto 64 characters.
     * If name is not provided, service uses a default name based on the deployment type. For SingleServer, default name
     * is {SID}vm. In case of HA-AvZone systems, default name will be {SID}{app/ascs/db}z{a/b}vm with an incrementor at
     * the end in case of more than 1 vm per layer. For distributed and HA-AvSet systems, default name will be
     * {SID}{app/ascs/db}vm with an incrementor at the end in case of more than 1 vm per layer.
     *
     * @param vmName the vmName value to set.
     * @return the VirtualMachineResourceNames object itself.
     */
    public VirtualMachineResourceNames withVmName(String vmName) {
        this.vmName = vmName;
        return this;
    }

    /**
     * Get the hostname property: The full name for virtual-machine's host (computer name). Currently, ACSS only
     * supports host names which are less than or equal to 13 characters long. If this value is not provided, vmName
     * will be used as host name.
     *
     * @return the hostname value.
     */
    public String hostname() {
        return this.hostname;
    }

    /**
     * Set the hostname property: The full name for virtual-machine's host (computer name). Currently, ACSS only
     * supports host names which are less than or equal to 13 characters long. If this value is not provided, vmName
     * will be used as host name.
     *
     * @param hostname the hostname value to set.
     * @return the VirtualMachineResourceNames object itself.
     */
    public VirtualMachineResourceNames withHostname(String hostname) {
        this.hostname = hostname;
        return this;
    }

    /**
     * Get the networkInterfaces property: The list of network interface name objects for the selected virtual machine.
     * Currently, only one network interface is supported per virtual machine.
     *
     * @return the networkInterfaces value.
     */
    public List<NetworkInterfaceResourceNames> networkInterfaces() {
        return this.networkInterfaces;
    }

    /**
     * Set the networkInterfaces property: The list of network interface name objects for the selected virtual machine.
     * Currently, only one network interface is supported per virtual machine.
     *
     * @param networkInterfaces the networkInterfaces value to set.
     * @return the VirtualMachineResourceNames object itself.
     */
    public VirtualMachineResourceNames withNetworkInterfaces(List<NetworkInterfaceResourceNames> networkInterfaces) {
        this.networkInterfaces = networkInterfaces;
        return this;
    }

    /**
     * Get the osDiskName property: The full name for OS disk attached to the VM. If this value is not provided, it will
     * be named by ARM as per its default naming standards (prefixed with vm name). There is only one OS disk attached
     * per Virtual Machine.
     *
     * @return the osDiskName value.
     */
    public String osDiskName() {
        return this.osDiskName;
    }

    /**
     * Set the osDiskName property: The full name for OS disk attached to the VM. If this value is not provided, it will
     * be named by ARM as per its default naming standards (prefixed with vm name). There is only one OS disk attached
     * per Virtual Machine.
     *
     * @param osDiskName the osDiskName value to set.
     * @return the VirtualMachineResourceNames object itself.
     */
    public VirtualMachineResourceNames withOsDiskName(String osDiskName) {
        this.osDiskName = osDiskName;
        return this;
    }

    /**
     * Get the dataDiskNames property: The full resource names for virtual machine data disks. This is a dictionary
     * containing list of names of data disks per volume. Currently supported volumes for database layer are
     * ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For application and cs layers, only 'default'
     * volume is supported.
     *
     * @return the dataDiskNames value.
     */
    public Map<String, List<String>> dataDiskNames() {
        return this.dataDiskNames;
    }

    /**
     * Set the dataDiskNames property: The full resource names for virtual machine data disks. This is a dictionary
     * containing list of names of data disks per volume. Currently supported volumes for database layer are
     * ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For application and cs layers, only 'default'
     * volume is supported.
     *
     * @param dataDiskNames the dataDiskNames value to set.
     * @return the VirtualMachineResourceNames object itself.
     */
    public VirtualMachineResourceNames withDataDiskNames(Map<String, List<String>> dataDiskNames) {
        this.dataDiskNames = dataDiskNames;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (networkInterfaces() != null) {
            networkInterfaces().forEach(e -> e.validate());
        }
    }
}
