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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.mobilenetwork.models.BillingSku;
import com.azure.resourcemanager.mobilenetwork.models.CoreNetworkType;
import com.azure.resourcemanager.mobilenetwork.models.DiagnosticsUploadConfiguration;
import com.azure.resourcemanager.mobilenetwork.models.Installation;
import com.azure.resourcemanager.mobilenetwork.models.InterfaceProperties;
import com.azure.resourcemanager.mobilenetwork.models.LocalDiagnosticsAccessConfiguration;
import com.azure.resourcemanager.mobilenetwork.models.PlatformConfiguration;
import com.azure.resourcemanager.mobilenetwork.models.ProvisioningState;
import com.azure.resourcemanager.mobilenetwork.models.SiteResourceId;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Packet core control plane properties. */
@Fluent
public final class PacketCoreControlPlanePropertiesFormat {
    /*
     * The provisioning state of the packet core control plane resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * The installation state of the packet core control plane resource.
     */
    @JsonProperty(value = "installation")
    private Installation installation;

    /*
     * Site(s) under which this packet core control plane should be deployed. The sites must be in the same location as
     * the packet core control plane.
     */
    @JsonProperty(value = "sites", required = true)
    private List<SiteResourceId> sites;

    /*
     * The platform where the packet core is deployed.
     */
    @JsonProperty(value = "platform", required = true)
    private PlatformConfiguration platform;

    /*
     * The core network technology generation (5G core or EPC / 4G core).
     */
    @JsonProperty(value = "coreNetworkTechnology")
    private CoreNetworkType coreNetworkTechnology;

    /*
     * The desired version of the packet core software.
     */
    @JsonProperty(value = "version")
    private String version;

    /*
     * The currently installed version of the packet core software.
     */
    @JsonProperty(value = "installedVersion", access = JsonProperty.Access.WRITE_ONLY)
    private String installedVersion;

    /*
     * The previous version of the packet core software that was deployed. Used when performing the rollback action.
     */
    @JsonProperty(value = "rollbackVersion", access = JsonProperty.Access.WRITE_ONLY)
    private String rollbackVersion;

    /*
     * The control plane interface on the access network. For 5G networks, this is the N2 interface. For 4G networks,
     * this is the S1-MME interface.
     */
    @JsonProperty(value = "controlPlaneAccessInterface", required = true)
    private InterfaceProperties controlPlaneAccessInterface;

    /*
     * The SKU defining the throughput and SIM allowances for this packet core control plane deployment.
     */
    @JsonProperty(value = "sku", required = true)
    private BillingSku sku;

    /*
     * The MTU (in bytes) signaled to the UE. The same MTU is set on the user plane data links for all data networks.
     * The MTU set on the user plane access link is calculated to be 60 bytes greater than this value to allow for GTP
     * encapsulation.
     */
    @JsonProperty(value = "ueMtu")
    private Integer ueMtu;

    /*
     * The kubernetes ingress configuration to control access to packet core diagnostics over local APIs.
     */
    @JsonProperty(value = "localDiagnosticsAccess", required = true)
    private LocalDiagnosticsAccessConfiguration localDiagnosticsAccess;

    /*
     * Configuration for uploading packet core diagnostics
     */
    @JsonProperty(value = "diagnosticsUpload")
    private DiagnosticsUploadConfiguration diagnosticsUpload;

    /*
     * Settings to allow interoperability with third party components e.g. RANs and UEs.
     */
    @JsonProperty(value = "interopSettings")
    private Object interopSettings;

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

    /**
     * Get the provisioningState property: The provisioning state of the packet core control plane resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the installation property: The installation state of the packet core control plane resource.
     *
     * @return the installation value.
     */
    public Installation installation() {
        return this.installation;
    }

    /**
     * Set the installation property: The installation state of the packet core control plane resource.
     *
     * @param installation the installation value to set.
     * @return the PacketCoreControlPlanePropertiesFormat object itself.
     */
    public PacketCoreControlPlanePropertiesFormat withInstallation(Installation installation) {
        this.installation = installation;
        return this;
    }

    /**
     * Get the sites property: Site(s) under which this packet core control plane should be deployed. The sites must be
     * in the same location as the packet core control plane.
     *
     * @return the sites value.
     */
    public List<SiteResourceId> sites() {
        return this.sites;
    }

    /**
     * Set the sites property: Site(s) under which this packet core control plane should be deployed. The sites must be
     * in the same location as the packet core control plane.
     *
     * @param sites the sites value to set.
     * @return the PacketCoreControlPlanePropertiesFormat object itself.
     */
    public PacketCoreControlPlanePropertiesFormat withSites(List<SiteResourceId> sites) {
        this.sites = sites;
        return this;
    }

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

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

    /**
     * Get the coreNetworkTechnology property: The core network technology generation (5G core or EPC / 4G core).
     *
     * @return the coreNetworkTechnology value.
     */
    public CoreNetworkType coreNetworkTechnology() {
        return this.coreNetworkTechnology;
    }

    /**
     * Set the coreNetworkTechnology property: The core network technology generation (5G core or EPC / 4G core).
     *
     * @param coreNetworkTechnology the coreNetworkTechnology value to set.
     * @return the PacketCoreControlPlanePropertiesFormat object itself.
     */
    public PacketCoreControlPlanePropertiesFormat withCoreNetworkTechnology(CoreNetworkType coreNetworkTechnology) {
        this.coreNetworkTechnology = coreNetworkTechnology;
        return this;
    }

    /**
     * Get the version property: The desired version of the packet core software.
     *
     * @return the version value.
     */
    public String version() {
        return this.version;
    }

    /**
     * Set the version property: The desired version of the packet core software.
     *
     * @param version the version value to set.
     * @return the PacketCoreControlPlanePropertiesFormat object itself.
     */
    public PacketCoreControlPlanePropertiesFormat withVersion(String version) {
        this.version = version;
        return this;
    }

    /**
     * Get the installedVersion property: The currently installed version of the packet core software.
     *
     * @return the installedVersion value.
     */
    public String installedVersion() {
        return this.installedVersion;
    }

    /**
     * Get the rollbackVersion property: The previous version of the packet core software that was deployed. Used when
     * performing the rollback action.
     *
     * @return the rollbackVersion value.
     */
    public String rollbackVersion() {
        return this.rollbackVersion;
    }

    /**
     * Get the controlPlaneAccessInterface property: The control plane interface on the access network. For 5G networks,
     * this is the N2 interface. For 4G networks, this is the S1-MME interface.
     *
     * @return the controlPlaneAccessInterface value.
     */
    public InterfaceProperties controlPlaneAccessInterface() {
        return this.controlPlaneAccessInterface;
    }

    /**
     * Set the controlPlaneAccessInterface property: The control plane interface on the access network. For 5G networks,
     * this is the N2 interface. For 4G networks, this is the S1-MME interface.
     *
     * @param controlPlaneAccessInterface the controlPlaneAccessInterface value to set.
     * @return the PacketCoreControlPlanePropertiesFormat object itself.
     */
    public PacketCoreControlPlanePropertiesFormat withControlPlaneAccessInterface(
        InterfaceProperties controlPlaneAccessInterface) {
        this.controlPlaneAccessInterface = controlPlaneAccessInterface;
        return this;
    }

    /**
     * Get the sku property: The SKU defining the throughput and SIM allowances for this packet core control plane
     * deployment.
     *
     * @return the sku value.
     */
    public BillingSku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The SKU defining the throughput and SIM allowances for this packet core control plane
     * deployment.
     *
     * @param sku the sku value to set.
     * @return the PacketCoreControlPlanePropertiesFormat object itself.
     */
    public PacketCoreControlPlanePropertiesFormat withSku(BillingSku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the ueMtu property: The MTU (in bytes) signaled to the UE. The same MTU is set on the user plane data links
     * for all data networks. The MTU set on the user plane access link is calculated to be 60 bytes greater than this
     * value to allow for GTP encapsulation.
     *
     * @return the ueMtu value.
     */
    public Integer ueMtu() {
        return this.ueMtu;
    }

    /**
     * Set the ueMtu property: The MTU (in bytes) signaled to the UE. The same MTU is set on the user plane data links
     * for all data networks. The MTU set on the user plane access link is calculated to be 60 bytes greater than this
     * value to allow for GTP encapsulation.
     *
     * @param ueMtu the ueMtu value to set.
     * @return the PacketCoreControlPlanePropertiesFormat object itself.
     */
    public PacketCoreControlPlanePropertiesFormat withUeMtu(Integer ueMtu) {
        this.ueMtu = ueMtu;
        return this;
    }

    /**
     * Get the localDiagnosticsAccess property: The kubernetes ingress configuration to control access to packet core
     * diagnostics over local APIs.
     *
     * @return the localDiagnosticsAccess value.
     */
    public LocalDiagnosticsAccessConfiguration localDiagnosticsAccess() {
        return this.localDiagnosticsAccess;
    }

    /**
     * Set the localDiagnosticsAccess property: The kubernetes ingress configuration to control access to packet core
     * diagnostics over local APIs.
     *
     * @param localDiagnosticsAccess the localDiagnosticsAccess value to set.
     * @return the PacketCoreControlPlanePropertiesFormat object itself.
     */
    public PacketCoreControlPlanePropertiesFormat withLocalDiagnosticsAccess(
        LocalDiagnosticsAccessConfiguration localDiagnosticsAccess) {
        this.localDiagnosticsAccess = localDiagnosticsAccess;
        return this;
    }

    /**
     * Get the diagnosticsUpload property: Configuration for uploading packet core diagnostics.
     *
     * @return the diagnosticsUpload value.
     */
    public DiagnosticsUploadConfiguration diagnosticsUpload() {
        return this.diagnosticsUpload;
    }

    /**
     * Set the diagnosticsUpload property: Configuration for uploading packet core diagnostics.
     *
     * @param diagnosticsUpload the diagnosticsUpload value to set.
     * @return the PacketCoreControlPlanePropertiesFormat object itself.
     */
    public PacketCoreControlPlanePropertiesFormat withDiagnosticsUpload(
        DiagnosticsUploadConfiguration diagnosticsUpload) {
        this.diagnosticsUpload = diagnosticsUpload;
        return this;
    }

    /**
     * Get the interopSettings property: Settings to allow interoperability with third party components e.g. RANs and
     * UEs.
     *
     * @return the interopSettings value.
     */
    public Object interopSettings() {
        return this.interopSettings;
    }

    /**
     * Set the interopSettings property: Settings to allow interoperability with third party components e.g. RANs and
     * UEs.
     *
     * @param interopSettings the interopSettings value to set.
     * @return the PacketCoreControlPlanePropertiesFormat object itself.
     */
    public PacketCoreControlPlanePropertiesFormat withInteropSettings(Object interopSettings) {
        this.interopSettings = interopSettings;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (installation() != null) {
            installation().validate();
        }
        if (sites() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property sites in model PacketCoreControlPlanePropertiesFormat"));
        } else {
            sites().forEach(e -> e.validate());
        }
        if (platform() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property platform in model PacketCoreControlPlanePropertiesFormat"));
        } else {
            platform().validate();
        }
        if (controlPlaneAccessInterface() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property controlPlaneAccessInterface in model"
                            + " PacketCoreControlPlanePropertiesFormat"));
        } else {
            controlPlaneAccessInterface().validate();
        }
        if (sku() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property sku in model PacketCoreControlPlanePropertiesFormat"));
        }
        if (localDiagnosticsAccess() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property localDiagnosticsAccess in model"
                            + " PacketCoreControlPlanePropertiesFormat"));
        } else {
            localDiagnosticsAccess().validate();
        }
        if (diagnosticsUpload() != null) {
            diagnosticsUpload().validate();
        }
    }

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