// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation;
import com.azure.resourcemanager.connectedvmware.models.FirmwareType;
import com.azure.resourcemanager.connectedvmware.models.GuestAgentProfile;
import com.azure.resourcemanager.connectedvmware.models.HardwareProfile;
import com.azure.resourcemanager.connectedvmware.models.Identity;
import com.azure.resourcemanager.connectedvmware.models.NetworkProfile;
import com.azure.resourcemanager.connectedvmware.models.OsProfile;
import com.azure.resourcemanager.connectedvmware.models.PlacementProfile;
import com.azure.resourcemanager.connectedvmware.models.ResourceStatus;
import com.azure.resourcemanager.connectedvmware.models.SecurityProfile;
import com.azure.resourcemanager.connectedvmware.models.StorageProfile;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Define the virtualMachine. */
@Fluent
public final class VirtualMachineInner extends Resource {
    /*
     * Resource properties.
     */
    @JsonProperty(value = "properties", required = true)
    private VirtualMachineProperties innerProperties = new VirtualMachineProperties();

    /*
     * Gets or sets the extended location.
     */
    @JsonProperty(value = "extendedLocation")
    private ExtendedLocation extendedLocation;

    /*
     * The system data.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g.
     * ApiApps are a kind of Microsoft.Web/sites type.  If supported, the resource provider must validate and persist
     * this value.
     */
    @JsonProperty(value = "kind")
    private String kind;

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

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

    /**
     * Get the extendedLocation property: Gets or sets the extended location.
     *
     * @return the extendedLocation value.
     */
    public ExtendedLocation extendedLocation() {
        return this.extendedLocation;
    }

    /**
     * Set the extendedLocation property: Gets or sets the extended location.
     *
     * @param extendedLocation the extendedLocation value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withExtendedLocation(ExtendedLocation extendedLocation) {
        this.extendedLocation = extendedLocation;
        return this;
    }

    /**
     * Get the systemData property: The system data.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of
     * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must
     * validate and persist this value.
     *
     * @return the kind value.
     */
    public String kind() {
        return this.kind;
    }

    /**
     * Set the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of
     * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must
     * validate and persist this value.
     *
     * @param kind the kind value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withKind(String kind) {
        this.kind = kind;
        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 VirtualMachineInner object itself.
     */
    public VirtualMachineInner withIdentity(Identity identity) {
        this.identity = identity;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public VirtualMachineInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public VirtualMachineInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the resourcePoolId property: Gets or sets the ARM Id of the resourcePool resource on which this virtual
     * machine will deploy.
     *
     * @return the resourcePoolId value.
     */
    public String resourcePoolId() {
        return this.innerProperties() == null ? null : this.innerProperties().resourcePoolId();
    }

    /**
     * Set the resourcePoolId property: Gets or sets the ARM Id of the resourcePool resource on which this virtual
     * machine will deploy.
     *
     * @param resourcePoolId the resourcePoolId value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withResourcePoolId(String resourcePoolId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withResourcePoolId(resourcePoolId);
        return this;
    }

    /**
     * Get the templateId property: Gets or sets the ARM Id of the template resource to deploy the virtual machine.
     *
     * @return the templateId value.
     */
    public String templateId() {
        return this.innerProperties() == null ? null : this.innerProperties().templateId();
    }

    /**
     * Set the templateId property: Gets or sets the ARM Id of the template resource to deploy the virtual machine.
     *
     * @param templateId the templateId value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withTemplateId(String templateId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withTemplateId(templateId);
        return this;
    }

    /**
     * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides.
     *
     * @return the vCenterId value.
     */
    public String vCenterId() {
        return this.innerProperties() == null ? null : this.innerProperties().vCenterId();
    }

    /**
     * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides.
     *
     * @param vCenterId the vCenterId value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withVCenterId(String vCenterId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withVCenterId(vCenterId);
        return this;
    }

    /**
     * Get the placementProfile property: Placement properties.
     *
     * @return the placementProfile value.
     */
    public PlacementProfile placementProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().placementProfile();
    }

    /**
     * Set the placementProfile property: Placement properties.
     *
     * @param placementProfile the placementProfile value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withPlacementProfile(PlacementProfile placementProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withPlacementProfile(placementProfile);
        return this;
    }

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

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

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

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

    /**
     * Get the networkProfile property: Network properties.
     *
     * @return the networkProfile value.
     */
    public NetworkProfile networkProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().networkProfile();
    }

    /**
     * Set the networkProfile property: Network properties.
     *
     * @param networkProfile the networkProfile value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withNetworkProfile(NetworkProfile networkProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withNetworkProfile(networkProfile);
        return this;
    }

    /**
     * Get the storageProfile property: Storage properties.
     *
     * @return the storageProfile value.
     */
    public StorageProfile storageProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().storageProfile();
    }

    /**
     * Set the storageProfile property: Storage properties.
     *
     * @param storageProfile the storageProfile value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withStorageProfile(StorageProfile storageProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withStorageProfile(storageProfile);
        return this;
    }

    /**
     * Get the guestAgentProfile property: Guest agent status properties.
     *
     * @return the guestAgentProfile value.
     */
    public GuestAgentProfile guestAgentProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().guestAgentProfile();
    }

    /**
     * Set the guestAgentProfile property: Guest agent status properties.
     *
     * @param guestAgentProfile the guestAgentProfile value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withGuestAgentProfile(GuestAgentProfile guestAgentProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withGuestAgentProfile(guestAgentProfile);
        return this;
    }

    /**
     * Get the securityProfile property: Gets the security profile.
     *
     * @return the securityProfile value.
     */
    public SecurityProfile securityProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().securityProfile();
    }

    /**
     * Set the securityProfile property: Gets the security profile.
     *
     * @param securityProfile the securityProfile value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withSecurityProfile(SecurityProfile securityProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withSecurityProfile(securityProfile);
        return this;
    }

    /**
     * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine.
     *
     * @return the moRefId value.
     */
    public String moRefId() {
        return this.innerProperties() == null ? null : this.innerProperties().moRefId();
    }

    /**
     * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine.
     *
     * @param moRefId the moRefId value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withMoRefId(String moRefId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withMoRefId(moRefId);
        return this;
    }

    /**
     * Get the inventoryItemId property: Gets or sets the inventory Item ID for the virtual machine.
     *
     * @return the inventoryItemId value.
     */
    public String inventoryItemId() {
        return this.innerProperties() == null ? null : this.innerProperties().inventoryItemId();
    }

    /**
     * Set the inventoryItemId property: Gets or sets the inventory Item ID for the virtual machine.
     *
     * @param inventoryItemId the inventoryItemId value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withInventoryItemId(String inventoryItemId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withInventoryItemId(inventoryItemId);
        return this;
    }

    /**
     * Get the moName property: Gets or sets the vCenter Managed Object name for the virtual machine.
     *
     * @return the moName value.
     */
    public String moName() {
        return this.innerProperties() == null ? null : this.innerProperties().moName();
    }

    /**
     * Get the folderPath property: Gets or sets the folder path of the vm.
     *
     * @return the folderPath value.
     */
    public String folderPath() {
        return this.innerProperties() == null ? null : this.innerProperties().folderPath();
    }

    /**
     * Get the instanceUuid property: Gets or sets the instance uuid of the vm.
     *
     * @return the instanceUuid value.
     */
    public String instanceUuid() {
        return this.innerProperties() == null ? null : this.innerProperties().instanceUuid();
    }

    /**
     * Get the smbiosUuid property: Gets or sets the SMBIOS UUID of the vm.
     *
     * @return the smbiosUuid value.
     */
    public String smbiosUuid() {
        return this.innerProperties() == null ? null : this.innerProperties().smbiosUuid();
    }

    /**
     * Set the smbiosUuid property: Gets or sets the SMBIOS UUID of the vm.
     *
     * @param smbiosUuid the smbiosUuid value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withSmbiosUuid(String smbiosUuid) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withSmbiosUuid(smbiosUuid);
        return this;
    }

    /**
     * Get the firmwareType property: Firmware type.
     *
     * @return the firmwareType value.
     */
    public FirmwareType firmwareType() {
        return this.innerProperties() == null ? null : this.innerProperties().firmwareType();
    }

    /**
     * Set the firmwareType property: Firmware type.
     *
     * @param firmwareType the firmwareType value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withFirmwareType(FirmwareType firmwareType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withFirmwareType(firmwareType);
        return this;
    }

    /**
     * Get the powerState property: Gets the power state of the virtual machine.
     *
     * @return the powerState value.
     */
    public String powerState() {
        return this.innerProperties() == null ? null : this.innerProperties().powerState();
    }

    /**
     * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes.
     *
     * @return the customResourceName value.
     */
    public String customResourceName() {
        return this.innerProperties() == null ? null : this.innerProperties().customResourceName();
    }

    /**
     * Get the uuid property: Gets or sets a unique identifier for this resource.
     *
     * @return the uuid value.
     */
    public String uuid() {
        return this.innerProperties() == null ? null : this.innerProperties().uuid();
    }

    /**
     * Get the statuses property: The resource status information.
     *
     * @return the statuses value.
     */
    public List<ResourceStatus> statuses() {
        return this.innerProperties() == null ? null : this.innerProperties().statuses();
    }

    /**
     * Get the provisioningState property: Gets or sets the provisioning state.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the vmId property: Gets or sets a unique identifier for the vm resource.
     *
     * @return the vmId value.
     */
    public String vmId() {
        return this.innerProperties() == null ? null : this.innerProperties().vmId();
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property innerProperties in model VirtualMachineInner"));
        } else {
            innerProperties().validate();
        }
        if (extendedLocation() != null) {
            extendedLocation().validate();
        }
        if (identity() != null) {
            identity().validate();
        }
    }

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