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

package com.azure.resourcemanager.hybridnetwork.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.SubResource;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** The reference to the Azure stack edge device. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "deviceType")
@JsonTypeName("AzureStackEdge")
@Fluent
public final class AzureStackEdgeFormat extends DevicePropertiesFormat {
    /*
     * The reference to the Azure stack edge device.
     */
    @JsonProperty(value = "azureStackEdge", required = true)
    private SubResource azureStackEdge;

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

    /**
     * Get the azureStackEdge property: The reference to the Azure stack edge device.
     *
     * @return the azureStackEdge value.
     */
    public SubResource azureStackEdge() {
        return this.azureStackEdge;
    }

    /**
     * Set the azureStackEdge property: The reference to the Azure stack edge device.
     *
     * @param azureStackEdge the azureStackEdge value to set.
     * @return the AzureStackEdgeFormat object itself.
     */
    public AzureStackEdgeFormat withAzureStackEdge(SubResource azureStackEdge) {
        this.azureStackEdge = azureStackEdge;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (azureStackEdge() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property azureStackEdge in model AzureStackEdgeFormat"));
        }
    }

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