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

package com.azure.resourcemanager.connectedvmware.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualMachineUpdateProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Defines the virtualMachineUpdate. */
@Fluent
public final class VirtualMachineUpdate {
    /*
     * Resource properties.
     */
    @JsonProperty(value = "properties")
    private VirtualMachineUpdateProperties innerProperties;

    /*
     * Gets or sets the Resource tags.
     */
    @JsonProperty(value = "tags")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> tags;

    /*
     * The identity of the resource.
     */
    @JsonProperty(value = "identity")
    private Identity identity;

    /**
     * Get the innerProperties property: Resource properties.
     *
     * @return the innerProperties value.
     */
    private VirtualMachineUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the tags property: Gets or sets the Resource tags.
     *
     * @return the tags value.
     */
    public Map<String, String> tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Gets or sets the Resource tags.
     *
     * @param tags the tags value to set.
     * @return the VirtualMachineUpdate object itself.
     */
    public VirtualMachineUpdate withTags(Map<String, String> tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the identity property: The identity of the resource.
     *
     * @return the identity value.
     */
    public Identity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: The identity of the resource.
     *
     * @param identity the identity value to set.
     * @return the VirtualMachineUpdate object itself.
     */
    public VirtualMachineUpdate withIdentity(Identity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the hardwareProfile property: Defines the resource properties.
     *
     * @return the hardwareProfile value.
     */
    public HardwareProfile hardwareProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().hardwareProfile();
    }

    /**
     * Set the hardwareProfile property: Defines the resource properties.
     *
     * @param hardwareProfile the hardwareProfile value to set.
     * @return the VirtualMachineUpdate object itself.
     */
    public VirtualMachineUpdate withHardwareProfile(HardwareProfile hardwareProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineUpdateProperties();
        }
        this.innerProperties().withHardwareProfile(hardwareProfile);
        return this;
    }

    /**
     * Get the osProfile property: OS properties.
     *
     * @return the osProfile value.
     */
    public OsProfileUpdate osProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().osProfile();
    }

    /**
     * Set the osProfile property: OS properties.
     *
     * @param osProfile the osProfile value to set.
     * @return the VirtualMachineUpdate object itself.
     */
    public VirtualMachineUpdate withOsProfile(OsProfileUpdate osProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineUpdateProperties();
        }
        this.innerProperties().withOsProfile(osProfile);
        return this;
    }

    /**
     * Get the storageProfile property: Defines the resource update properties.
     *
     * @return the storageProfile value.
     */
    public StorageProfileUpdate storageProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().storageProfile();
    }

    /**
     * Set the storageProfile property: Defines the resource update properties.
     *
     * @param storageProfile the storageProfile value to set.
     * @return the VirtualMachineUpdate object itself.
     */
    public VirtualMachineUpdate withStorageProfile(StorageProfileUpdate storageProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineUpdateProperties();
        }
        this.innerProperties().withStorageProfile(storageProfile);
        return this;
    }

    /**
     * Get the networkProfile property: Defines the update resource properties.
     *
     * @return the networkProfile value.
     */
    public NetworkProfileUpdate networkProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().networkProfile();
    }

    /**
     * Set the networkProfile property: Defines the update resource properties.
     *
     * @param networkProfile the networkProfile value to set.
     * @return the VirtualMachineUpdate object itself.
     */
    public VirtualMachineUpdate withNetworkProfile(NetworkProfileUpdate networkProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineUpdateProperties();
        }
        this.innerProperties().withNetworkProfile(networkProfile);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
        if (identity() != null) {
            identity().validate();
        }
    }
}
