// 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.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Defines the virtual machine configuration. */
@Fluent
public final class VirtualMachineConfiguration {
    /*
     * The virtual machine size.
     */
    @JsonProperty(value = "vmSize", required = true)
    private String vmSize;

    /*
     * The image reference.
     */
    @JsonProperty(value = "imageReference", required = true)
    private ImageReference imageReference;

    /*
     * The OS profile.
     */
    @JsonProperty(value = "osProfile", required = true)
    private OSProfile osProfile;

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

    /**
     * Get the vmSize property: The virtual machine size.
     *
     * @return the vmSize value.
     */
    public String vmSize() {
        return this.vmSize;
    }

    /**
     * Set the vmSize property: The virtual machine size.
     *
     * @param vmSize the vmSize value to set.
     * @return the VirtualMachineConfiguration object itself.
     */
    public VirtualMachineConfiguration withVmSize(String vmSize) {
        this.vmSize = vmSize;
        return this;
    }

    /**
     * Get the imageReference property: The image reference.
     *
     * @return the imageReference value.
     */
    public ImageReference imageReference() {
        return this.imageReference;
    }

    /**
     * Set the imageReference property: The image reference.
     *
     * @param imageReference the imageReference value to set.
     * @return the VirtualMachineConfiguration object itself.
     */
    public VirtualMachineConfiguration withImageReference(ImageReference imageReference) {
        this.imageReference = imageReference;
        return this;
    }

    /**
     * Get the osProfile property: The OS profile.
     *
     * @return the osProfile value.
     */
    public OSProfile osProfile() {
        return this.osProfile;
    }

    /**
     * Set the osProfile property: The OS profile.
     *
     * @param osProfile the osProfile value to set.
     * @return the VirtualMachineConfiguration object itself.
     */
    public VirtualMachineConfiguration withOsProfile(OSProfile osProfile) {
        this.osProfile = osProfile;
        return this;
    }

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

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