// 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.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.mobilenetwork.models.InterfaceProperties;
import com.azure.resourcemanager.mobilenetwork.models.NaptConfiguration;
import com.azure.resourcemanager.mobilenetwork.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Attached data network resource. Must be created in the same location as its parent packet core data plane. */
@Fluent
public final class AttachedDataNetworkInner extends Resource {
    /*
     * Attached data network properties.
     */
    @JsonProperty(value = "properties", required = true)
    private AttachedDataNetworkPropertiesFormat innerProperties = new AttachedDataNetworkPropertiesFormat();

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the innerProperties property: Attached data network properties.
     *
     * @return the innerProperties value.
     */
    private AttachedDataNetworkPropertiesFormat innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

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

    /** {@inheritDoc} */
    @Override
    public AttachedDataNetworkInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning state of the attached data network resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the userPlaneDataInterface property: The user plane interface on the data network. For 5G networks, this is
     * the N6 interface. For 4G networks, this is the SGi interface.
     *
     * @return the userPlaneDataInterface value.
     */
    public InterfaceProperties userPlaneDataInterface() {
        return this.innerProperties() == null ? null : this.innerProperties().userPlaneDataInterface();
    }

    /**
     * Set the userPlaneDataInterface property: The user plane interface on the data network. For 5G networks, this is
     * the N6 interface. For 4G networks, this is the SGi interface.
     *
     * @param userPlaneDataInterface the userPlaneDataInterface value to set.
     * @return the AttachedDataNetworkInner object itself.
     */
    public AttachedDataNetworkInner withUserPlaneDataInterface(InterfaceProperties userPlaneDataInterface) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttachedDataNetworkPropertiesFormat();
        }
        this.innerProperties().withUserPlaneDataInterface(userPlaneDataInterface);
        return this;
    }

    /**
     * Get the dnsAddresses property: The DNS servers to signal to UEs to use for this attached data network. This
     * configuration is mandatory - if you don't want DNS servers, you must provide an empty array.
     *
     * @return the dnsAddresses value.
     */
    public List<String> dnsAddresses() {
        return this.innerProperties() == null ? null : this.innerProperties().dnsAddresses();
    }

    /**
     * Set the dnsAddresses property: The DNS servers to signal to UEs to use for this attached data network. This
     * configuration is mandatory - if you don't want DNS servers, you must provide an empty array.
     *
     * @param dnsAddresses the dnsAddresses value to set.
     * @return the AttachedDataNetworkInner object itself.
     */
    public AttachedDataNetworkInner withDnsAddresses(List<String> dnsAddresses) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttachedDataNetworkPropertiesFormat();
        }
        this.innerProperties().withDnsAddresses(dnsAddresses);
        return this;
    }

    /**
     * Get the naptConfiguration property: The network address and port translation (NAPT) configuration. If this is not
     * specified, the attached data network will use a default NAPT configuration with NAPT enabled.
     *
     * @return the naptConfiguration value.
     */
    public NaptConfiguration naptConfiguration() {
        return this.innerProperties() == null ? null : this.innerProperties().naptConfiguration();
    }

    /**
     * Set the naptConfiguration property: The network address and port translation (NAPT) configuration. If this is not
     * specified, the attached data network will use a default NAPT configuration with NAPT enabled.
     *
     * @param naptConfiguration the naptConfiguration value to set.
     * @return the AttachedDataNetworkInner object itself.
     */
    public AttachedDataNetworkInner withNaptConfiguration(NaptConfiguration naptConfiguration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttachedDataNetworkPropertiesFormat();
        }
        this.innerProperties().withNaptConfiguration(naptConfiguration);
        return this;
    }

    /**
     * Get the userEquipmentAddressPoolPrefix property: The user equipment (UE) address pool prefixes for the attached
     * data network from which the packet core instance will dynamically assign IP addresses to UEs. The packet core
     * instance assigns an IP address to a UE when the UE sets up a PDU session. You must define at least one of
     * userEquipmentAddressPoolPrefix and userEquipmentStaticAddressPoolPrefix. If you define both, they must be of the
     * same size.
     *
     * @return the userEquipmentAddressPoolPrefix value.
     */
    public List<String> userEquipmentAddressPoolPrefix() {
        return this.innerProperties() == null ? null : this.innerProperties().userEquipmentAddressPoolPrefix();
    }

    /**
     * Set the userEquipmentAddressPoolPrefix property: The user equipment (UE) address pool prefixes for the attached
     * data network from which the packet core instance will dynamically assign IP addresses to UEs. The packet core
     * instance assigns an IP address to a UE when the UE sets up a PDU session. You must define at least one of
     * userEquipmentAddressPoolPrefix and userEquipmentStaticAddressPoolPrefix. If you define both, they must be of the
     * same size.
     *
     * @param userEquipmentAddressPoolPrefix the userEquipmentAddressPoolPrefix value to set.
     * @return the AttachedDataNetworkInner object itself.
     */
    public AttachedDataNetworkInner withUserEquipmentAddressPoolPrefix(List<String> userEquipmentAddressPoolPrefix) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttachedDataNetworkPropertiesFormat();
        }
        this.innerProperties().withUserEquipmentAddressPoolPrefix(userEquipmentAddressPoolPrefix);
        return this;
    }

    /**
     * Get the userEquipmentStaticAddressPoolPrefix property: The user equipment (UE) address pool prefixes for the
     * attached data network from which the packet core instance will assign static IP addresses to UEs. The packet core
     * instance assigns an IP address to a UE when the UE sets up a PDU session. The static IP address for a specific UE
     * is set in StaticIPConfiguration on the corresponding SIM resource. At least one of userEquipmentAddressPoolPrefix
     * and userEquipmentStaticAddressPoolPrefix must be defined. If both are defined, they must be of the same size.
     *
     * @return the userEquipmentStaticAddressPoolPrefix value.
     */
    public List<String> userEquipmentStaticAddressPoolPrefix() {
        return this.innerProperties() == null ? null : this.innerProperties().userEquipmentStaticAddressPoolPrefix();
    }

    /**
     * Set the userEquipmentStaticAddressPoolPrefix property: The user equipment (UE) address pool prefixes for the
     * attached data network from which the packet core instance will assign static IP addresses to UEs. The packet core
     * instance assigns an IP address to a UE when the UE sets up a PDU session. The static IP address for a specific UE
     * is set in StaticIPConfiguration on the corresponding SIM resource. At least one of userEquipmentAddressPoolPrefix
     * and userEquipmentStaticAddressPoolPrefix must be defined. If both are defined, they must be of the same size.
     *
     * @param userEquipmentStaticAddressPoolPrefix the userEquipmentStaticAddressPoolPrefix value to set.
     * @return the AttachedDataNetworkInner object itself.
     */
    public AttachedDataNetworkInner withUserEquipmentStaticAddressPoolPrefix(
        List<String> userEquipmentStaticAddressPoolPrefix) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttachedDataNetworkPropertiesFormat();
        }
        this.innerProperties().withUserEquipmentStaticAddressPoolPrefix(userEquipmentStaticAddressPoolPrefix);
        return this;
    }

    /**
     * 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 AttachedDataNetworkInner"));
        } else {
            innerProperties().validate();
        }
    }

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