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

package com.azure.resourcemanager.scvmm.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.scvmm.models.AvailabilitySetListItem;
import com.azure.resourcemanager.scvmm.models.Checkpoint;
import com.azure.resourcemanager.scvmm.models.ExtendedLocation;
import com.azure.resourcemanager.scvmm.models.HardwareProfile;
import com.azure.resourcemanager.scvmm.models.NetworkProfile;
import com.azure.resourcemanager.scvmm.models.OsProfile;
import com.azure.resourcemanager.scvmm.models.StorageProfile;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** The VirtualMachines resource definition. */
@Fluent
public final class VirtualMachineInner extends Resource {
    /*
     * Resource properties.
     */
    @JsonProperty(value = "properties", required = true)
    private VirtualMachineProperties innerProperties = new VirtualMachineProperties();

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

    /*
     * The extended location.
     */
    @JsonProperty(value = "extendedLocation", required = true)
    private ExtendedLocation extendedLocation;

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

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

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

    /**
     * Set the extendedLocation property: 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;
    }

    /** {@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 inventoryItemId property: Gets or sets the inventory Item ID for the resource.
     *
     * @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 resource.
     *
     * @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 vmmServerId property: ARM Id of the vmmServer resource in which this resource resides.
     *
     * @return the vmmServerId value.
     */
    public String vmmServerId() {
        return this.innerProperties() == null ? null : this.innerProperties().vmmServerId();
    }

    /**
     * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides.
     *
     * @param vmmServerId the vmmServerId value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withVmmServerId(String vmmServerId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withVmmServerId(vmmServerId);
        return this;
    }

    /**
     * Get the cloudId property: ARM Id of the cloud resource to use for deploying the vm.
     *
     * @return the cloudId value.
     */
    public String cloudId() {
        return this.innerProperties() == null ? null : this.innerProperties().cloudId();
    }

    /**
     * Set the cloudId property: ARM Id of the cloud resource to use for deploying the vm.
     *
     * @param cloudId the cloudId value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withCloudId(String cloudId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withCloudId(cloudId);
        return this;
    }

    /**
     * Get the templateId property: ARM Id of the template resource to use for deploying the vm.
     *
     * @return the templateId value.
     */
    public String templateId() {
        return this.innerProperties() == null ? null : this.innerProperties().templateId();
    }

    /**
     * Set the templateId property: ARM Id of the template resource to use for deploying the vm.
     *
     * @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 checkpointType property: Type of checkpoint supported for the vm.
     *
     * @return the checkpointType value.
     */
    public String checkpointType() {
        return this.innerProperties() == null ? null : this.innerProperties().checkpointType();
    }

    /**
     * Set the checkpointType property: Type of checkpoint supported for the vm.
     *
     * @param checkpointType the checkpointType value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withCheckpointType(String checkpointType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withCheckpointType(checkpointType);
        return this;
    }

    /**
     * Get the checkpoints property: Checkpoints in the vm.
     *
     * @return the checkpoints value.
     */
    public List<Checkpoint> checkpoints() {
        return this.innerProperties() == null ? null : this.innerProperties().checkpoints();
    }

    /**
     * Set the checkpoints property: Checkpoints in the vm.
     *
     * @param checkpoints the checkpoints value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withCheckpoints(List<Checkpoint> checkpoints) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withCheckpoints(checkpoints);
        return this;
    }

    /**
     * Get the availabilitySets property: Availability Sets in vm.
     *
     * @return the availabilitySets value.
     */
    public List<AvailabilitySetListItem> availabilitySets() {
        return this.innerProperties() == null ? null : this.innerProperties().availabilitySets();
    }

    /**
     * Set the availabilitySets property: Availability Sets in vm.
     *
     * @param availabilitySets the availabilitySets value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withAvailabilitySets(List<AvailabilitySetListItem> availabilitySets) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withAvailabilitySets(availabilitySets);
        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 vmName property: VMName is the name of VM on the SCVMM server.
     *
     * @return the vmName value.
     */
    public String vmName() {
        return this.innerProperties() == null ? null : this.innerProperties().vmName();
    }

    /**
     * Set the vmName property: VMName is the name of VM on the SCVMM server.
     *
     * @param vmName the vmName value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withVmName(String vmName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withVmName(vmName);
        return this;
    }

    /**
     * Get the uuid property: Unique ID of the virtual machine.
     *
     * @return the uuid value.
     */
    public String uuid() {
        return this.innerProperties() == null ? null : this.innerProperties().uuid();
    }

    /**
     * Set the uuid property: Unique ID of the virtual machine.
     *
     * @param uuid the uuid value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withUuid(String uuid) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withUuid(uuid);
        return this;
    }

    /**
     * Get the generation property: Gets or sets the generation for the vm.
     *
     * @return the generation value.
     */
    public Integer generation() {
        return this.innerProperties() == null ? null : this.innerProperties().generation();
    }

    /**
     * Set the generation property: Gets or sets the generation for the vm.
     *
     * @param generation the generation value to set.
     * @return the VirtualMachineInner object itself.
     */
    public VirtualMachineInner withGeneration(Integer generation) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineProperties();
        }
        this.innerProperties().withGeneration(generation);
        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 provisioningState property: Gets or sets the provisioning state.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * 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) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property extendedLocation in model VirtualMachineInner"));
        } else {
            extendedLocation().validate();
        }
    }

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