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

package com.azure.resourcemanager.mobilenetwork.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The platform where the packet core is deployed. */
@Fluent
public final class PlatformConfiguration {
    /*
     * The platform type where packet core is deployed.
     */
    @JsonProperty(value = "type", required = true)
    private PlatformType type;

    /*
     * The Azure Stack Edge device where the packet core is deployed. If the device is part of a fault tolerant pair,
     * either device in the pair can be specified.
     */
    @JsonProperty(value = "azureStackEdgeDevice")
    private AzureStackEdgeDeviceResourceId azureStackEdgeDevice;

    /*
     * The Azure Stack Edge devices where the packet core is deployed. If the packet core is deployed across multiple
     * devices, all devices will appear in this list.
     */
    @JsonProperty(value = "azureStackEdgeDevices", access = JsonProperty.Access.WRITE_ONLY)
    private List<AzureStackEdgeDeviceResourceId> azureStackEdgeDevices;

    /*
     * The Azure Stack HCI cluster where the packet core is deployed.
     */
    @JsonProperty(value = "azureStackHciCluster")
    private AzureStackHciClusterResourceId azureStackHciCluster;

    /*
     * Azure Arc connected cluster where the packet core is deployed.
     */
    @JsonProperty(value = "connectedCluster")
    private ConnectedClusterResourceId connectedCluster;

    /*
     * Azure Arc custom location where the packet core is deployed.
     */
    @JsonProperty(value = "customLocation")
    private CustomLocationResourceId customLocation;

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

    /**
     * Get the type property: The platform type where packet core is deployed.
     *
     * @return the type value.
     */
    public PlatformType type() {
        return this.type;
    }

    /**
     * Set the type property: The platform type where packet core is deployed.
     *
     * @param type the type value to set.
     * @return the PlatformConfiguration object itself.
     */
    public PlatformConfiguration withType(PlatformType type) {
        this.type = type;
        return this;
    }

    /**
     * Get the azureStackEdgeDevice property: The Azure Stack Edge device where the packet core is deployed. If the
     * device is part of a fault tolerant pair, either device in the pair can be specified.
     *
     * @return the azureStackEdgeDevice value.
     */
    public AzureStackEdgeDeviceResourceId azureStackEdgeDevice() {
        return this.azureStackEdgeDevice;
    }

    /**
     * Set the azureStackEdgeDevice property: The Azure Stack Edge device where the packet core is deployed. If the
     * device is part of a fault tolerant pair, either device in the pair can be specified.
     *
     * @param azureStackEdgeDevice the azureStackEdgeDevice value to set.
     * @return the PlatformConfiguration object itself.
     */
    public PlatformConfiguration withAzureStackEdgeDevice(AzureStackEdgeDeviceResourceId azureStackEdgeDevice) {
        this.azureStackEdgeDevice = azureStackEdgeDevice;
        return this;
    }

    /**
     * Get the azureStackEdgeDevices property: The Azure Stack Edge devices where the packet core is deployed. If the
     * packet core is deployed across multiple devices, all devices will appear in this list.
     *
     * @return the azureStackEdgeDevices value.
     */
    public List<AzureStackEdgeDeviceResourceId> azureStackEdgeDevices() {
        return this.azureStackEdgeDevices;
    }

    /**
     * Get the azureStackHciCluster property: The Azure Stack HCI cluster where the packet core is deployed.
     *
     * @return the azureStackHciCluster value.
     */
    public AzureStackHciClusterResourceId azureStackHciCluster() {
        return this.azureStackHciCluster;
    }

    /**
     * Set the azureStackHciCluster property: The Azure Stack HCI cluster where the packet core is deployed.
     *
     * @param azureStackHciCluster the azureStackHciCluster value to set.
     * @return the PlatformConfiguration object itself.
     */
    public PlatformConfiguration withAzureStackHciCluster(AzureStackHciClusterResourceId azureStackHciCluster) {
        this.azureStackHciCluster = azureStackHciCluster;
        return this;
    }

    /**
     * Get the connectedCluster property: Azure Arc connected cluster where the packet core is deployed.
     *
     * @return the connectedCluster value.
     */
    public ConnectedClusterResourceId connectedCluster() {
        return this.connectedCluster;
    }

    /**
     * Set the connectedCluster property: Azure Arc connected cluster where the packet core is deployed.
     *
     * @param connectedCluster the connectedCluster value to set.
     * @return the PlatformConfiguration object itself.
     */
    public PlatformConfiguration withConnectedCluster(ConnectedClusterResourceId connectedCluster) {
        this.connectedCluster = connectedCluster;
        return this;
    }

    /**
     * Get the customLocation property: Azure Arc custom location where the packet core is deployed.
     *
     * @return the customLocation value.
     */
    public CustomLocationResourceId customLocation() {
        return this.customLocation;
    }

    /**
     * Set the customLocation property: Azure Arc custom location where the packet core is deployed.
     *
     * @param customLocation the customLocation value to set.
     * @return the PlatformConfiguration object itself.
     */
    public PlatformConfiguration withCustomLocation(CustomLocationResourceId customLocation) {
        this.customLocation = customLocation;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (type() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property type in model PlatformConfiguration"));
        }
        if (azureStackEdgeDevice() != null) {
            azureStackEdgeDevice().validate();
        }
        if (azureStackEdgeDevices() != null) {
            azureStackEdgeDevices().forEach(e -> e.validate());
        }
        if (azureStackHciCluster() != null) {
            azureStackHciCluster().validate();
        }
        if (connectedCluster() != null) {
            connectedCluster().validate();
        }
        if (customLocation() != null) {
            customLocation().validate();
        }
    }

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