// 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.DynamicMemoryEnabled;
import com.azure.resourcemanager.scvmm.models.ExtendedLocation;
import com.azure.resourcemanager.scvmm.models.IsCustomizable;
import com.azure.resourcemanager.scvmm.models.LimitCpuForMigration;
import com.azure.resourcemanager.scvmm.models.NetworkInterfaces;
import com.azure.resourcemanager.scvmm.models.OsType;
import com.azure.resourcemanager.scvmm.models.VirtualDisk;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

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

    /*
     * 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 VirtualMachineTemplateProperties 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 VirtualMachineTemplateInner object itself.
     */
    public VirtualMachineTemplateInner withExtendedLocation(ExtendedLocation extendedLocation) {
        this.extendedLocation = extendedLocation;
        return this;
    }

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

    /** {@inheritDoc} */
    @Override
    public VirtualMachineTemplateInner 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 VirtualMachineTemplateInner object itself.
     */
    public VirtualMachineTemplateInner withInventoryItemId(String inventoryItemId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineTemplateProperties();
        }
        this.innerProperties().withInventoryItemId(inventoryItemId);
        return this;
    }

    /**
     * Get the uuid property: Unique ID of the virtual machine template.
     *
     * @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 template.
     *
     * @param uuid the uuid value to set.
     * @return the VirtualMachineTemplateInner object itself.
     */
    public VirtualMachineTemplateInner withUuid(String uuid) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineTemplateProperties();
        }
        this.innerProperties().withUuid(uuid);
        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 VirtualMachineTemplateInner object itself.
     */
    public VirtualMachineTemplateInner withVmmServerId(String vmmServerId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualMachineTemplateProperties();
        }
        this.innerProperties().withVmmServerId(vmmServerId);
        return this;
    }

    /**
     * Get the osType property: Gets or sets the type of the os.
     *
     * @return the osType value.
     */
    public OsType osType() {
        return this.innerProperties() == null ? null : this.innerProperties().osType();
    }

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

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

    /**
     * Get the memoryMB property: MemoryMB is the desired size of a virtual machine's memory, in MB.
     *
     * @return the memoryMB value.
     */
    public Integer memoryMB() {
        return this.innerProperties() == null ? null : this.innerProperties().memoryMB();
    }

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

    /**
     * Get the limitCpuForMigration property: Gets or sets a value indicating whether to enable processor compatibility
     * mode for live migration of VMs.
     *
     * @return the limitCpuForMigration value.
     */
    public LimitCpuForMigration limitCpuForMigration() {
        return this.innerProperties() == null ? null : this.innerProperties().limitCpuForMigration();
    }

    /**
     * Get the dynamicMemoryEnabled property: Gets or sets a value indicating whether to enable dynamic memory or not.
     *
     * @return the dynamicMemoryEnabled value.
     */
    public DynamicMemoryEnabled dynamicMemoryEnabled() {
        return this.innerProperties() == null ? null : this.innerProperties().dynamicMemoryEnabled();
    }

    /**
     * Get the isCustomizable property: Gets or sets a value indicating whether the vm template is customizable or not.
     *
     * @return the isCustomizable value.
     */
    public IsCustomizable isCustomizable() {
        return this.innerProperties() == null ? null : this.innerProperties().isCustomizable();
    }

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

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

    /**
     * Get the isHighlyAvailable property: Gets highly available property.
     *
     * @return the isHighlyAvailable value.
     */
    public String isHighlyAvailable() {
        return this.innerProperties() == null ? null : this.innerProperties().isHighlyAvailable();
    }

    /**
     * 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();
    }

    /**
     * Get the networkInterfaces property: Gets or sets the network interfaces of the template.
     *
     * @return the networkInterfaces value.
     */
    public List<NetworkInterfaces> networkInterfaces() {
        return this.innerProperties() == null ? null : this.innerProperties().networkInterfaces();
    }

    /**
     * Get the disks property: Gets or sets the disks of the template.
     *
     * @return the disks value.
     */
    public List<VirtualDisk> disks() {
        return this.innerProperties() == null ? null : this.innerProperties().disks();
    }

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

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