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

/** BareMetalMachineConfigurationData represents configuration for the bare metal machine. */
@Fluent
public final class BareMetalMachineConfigurationData {
    /*
     * The connection string for the baseboard management controller including IP address and protocol.
     */
    @JsonProperty(value = "bmcConnectionString", access = JsonProperty.Access.WRITE_ONLY)
    private String bmcConnectionString;

    /*
     * AdministrativeCredentials represents the admin credentials for the device requiring password-based
     * authentication.
     *
     * The credentials of the baseboard management controller on this bare metal machine.
     */
    @JsonProperty(value = "bmcCredentials", required = true)
    private AdministrativeCredentials bmcCredentials;

    /*
     * The MAC address of the BMC for this machine.
     */
    @JsonProperty(value = "bmcMacAddress", required = true)
    private String bmcMacAddress;

    /*
     * The MAC address associated with the PXE NIC card.
     */
    @JsonProperty(value = "bootMacAddress", required = true)
    private String bootMacAddress;

    /*
     * The free-form additional information about the machine, e.g. an asset tag.
     */
    @JsonProperty(value = "machineDetails")
    private String machineDetails;

    /*
     * The user-provided name for the bare metal machine created from this specification.
     * If not provided, the machine name will be generated programmatically.
     */
    @JsonProperty(value = "machineName")
    private String machineName;

    /*
     * The slot the physical machine is in the rack based on the BOM configuration.
     */
    @JsonProperty(value = "rackSlot", required = true)
    private long rackSlot;

    /*
     * The serial number of the machine. Hardware suppliers may use an alternate value. For example, service tag.
     */
    @JsonProperty(value = "serialNumber", required = true)
    private String serialNumber;

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

    /**
     * Get the bmcConnectionString property: The connection string for the baseboard management controller including IP
     * address and protocol.
     *
     * @return the bmcConnectionString value.
     */
    public String bmcConnectionString() {
        return this.bmcConnectionString;
    }

    /**
     * Get the bmcCredentials property: AdministrativeCredentials represents the admin credentials for the device
     * requiring password-based authentication.
     *
     * <p>The credentials of the baseboard management controller on this bare metal machine.
     *
     * @return the bmcCredentials value.
     */
    public AdministrativeCredentials bmcCredentials() {
        return this.bmcCredentials;
    }

    /**
     * Set the bmcCredentials property: AdministrativeCredentials represents the admin credentials for the device
     * requiring password-based authentication.
     *
     * <p>The credentials of the baseboard management controller on this bare metal machine.
     *
     * @param bmcCredentials the bmcCredentials value to set.
     * @return the BareMetalMachineConfigurationData object itself.
     */
    public BareMetalMachineConfigurationData withBmcCredentials(AdministrativeCredentials bmcCredentials) {
        this.bmcCredentials = bmcCredentials;
        return this;
    }

    /**
     * Get the bmcMacAddress property: The MAC address of the BMC for this machine.
     *
     * @return the bmcMacAddress value.
     */
    public String bmcMacAddress() {
        return this.bmcMacAddress;
    }

    /**
     * Set the bmcMacAddress property: The MAC address of the BMC for this machine.
     *
     * @param bmcMacAddress the bmcMacAddress value to set.
     * @return the BareMetalMachineConfigurationData object itself.
     */
    public BareMetalMachineConfigurationData withBmcMacAddress(String bmcMacAddress) {
        this.bmcMacAddress = bmcMacAddress;
        return this;
    }

    /**
     * Get the bootMacAddress property: The MAC address associated with the PXE NIC card.
     *
     * @return the bootMacAddress value.
     */
    public String bootMacAddress() {
        return this.bootMacAddress;
    }

    /**
     * Set the bootMacAddress property: The MAC address associated with the PXE NIC card.
     *
     * @param bootMacAddress the bootMacAddress value to set.
     * @return the BareMetalMachineConfigurationData object itself.
     */
    public BareMetalMachineConfigurationData withBootMacAddress(String bootMacAddress) {
        this.bootMacAddress = bootMacAddress;
        return this;
    }

    /**
     * Get the machineDetails property: The free-form additional information about the machine, e.g. an asset tag.
     *
     * @return the machineDetails value.
     */
    public String machineDetails() {
        return this.machineDetails;
    }

    /**
     * Set the machineDetails property: The free-form additional information about the machine, e.g. an asset tag.
     *
     * @param machineDetails the machineDetails value to set.
     * @return the BareMetalMachineConfigurationData object itself.
     */
    public BareMetalMachineConfigurationData withMachineDetails(String machineDetails) {
        this.machineDetails = machineDetails;
        return this;
    }

    /**
     * Get the machineName property: The user-provided name for the bare metal machine created from this specification.
     * If not provided, the machine name will be generated programmatically.
     *
     * @return the machineName value.
     */
    public String machineName() {
        return this.machineName;
    }

    /**
     * Set the machineName property: The user-provided name for the bare metal machine created from this specification.
     * If not provided, the machine name will be generated programmatically.
     *
     * @param machineName the machineName value to set.
     * @return the BareMetalMachineConfigurationData object itself.
     */
    public BareMetalMachineConfigurationData withMachineName(String machineName) {
        this.machineName = machineName;
        return this;
    }

    /**
     * Get the rackSlot property: The slot the physical machine is in the rack based on the BOM configuration.
     *
     * @return the rackSlot value.
     */
    public long rackSlot() {
        return this.rackSlot;
    }

    /**
     * Set the rackSlot property: The slot the physical machine is in the rack based on the BOM configuration.
     *
     * @param rackSlot the rackSlot value to set.
     * @return the BareMetalMachineConfigurationData object itself.
     */
    public BareMetalMachineConfigurationData withRackSlot(long rackSlot) {
        this.rackSlot = rackSlot;
        return this;
    }

    /**
     * Get the serialNumber property: The serial number of the machine. Hardware suppliers may use an alternate value.
     * For example, service tag.
     *
     * @return the serialNumber value.
     */
    public String serialNumber() {
        return this.serialNumber;
    }

    /**
     * Set the serialNumber property: The serial number of the machine. Hardware suppliers may use an alternate value.
     * For example, service tag.
     *
     * @param serialNumber the serialNumber value to set.
     * @return the BareMetalMachineConfigurationData object itself.
     */
    public BareMetalMachineConfigurationData withSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (bmcCredentials() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property bmcCredentials in model BareMetalMachineConfigurationData"));
        } else {
            bmcCredentials().validate();
        }
        if (bmcMacAddress() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property bmcMacAddress in model BareMetalMachineConfigurationData"));
        }
        if (bootMacAddress() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property bootMacAddress in model BareMetalMachineConfigurationData"));
        }
        if (serialNumber() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property serialNumber in model BareMetalMachineConfigurationData"));
        }
    }

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