// 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.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mobilenetwork.models.NaptConfiguration;
import com.azure.resourcemanager.mobilenetwork.models.NaptEnabled;
import com.azure.resourcemanager.mobilenetwork.models.PinholeTimeouts;
import com.azure.resourcemanager.mobilenetwork.models.PortRange;
import com.azure.resourcemanager.mobilenetwork.models.PortReuseHoldTimes;
import org.junit.jupiter.api.Assertions;

public final class NaptConfigurationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        NaptConfiguration model =
            BinaryData
                .fromString(
                    "{\"enabled\":\"Disabled\",\"portRange\":{\"minPort\":1991761310,\"maxPort\":1674535960},\"portReuseHoldTime\":{\"tcp\":14804050,\"udp\":2045600331},\"pinholeLimits\":1132741350,\"pinholeTimeouts\":{\"tcp\":1617618462,\"udp\":1833864756,\"icmp\":1656493513}}")
                .toObject(NaptConfiguration.class);
        Assertions.assertEquals(NaptEnabled.DISABLED, model.enabled());
        Assertions.assertEquals(1991761310, model.portRange().minPort());
        Assertions.assertEquals(1674535960, model.portRange().maxPort());
        Assertions.assertEquals(14804050, model.portReuseHoldTime().tcp());
        Assertions.assertEquals(2045600331, model.portReuseHoldTime().udp());
        Assertions.assertEquals(1132741350, model.pinholeLimits());
        Assertions.assertEquals(1617618462, model.pinholeTimeouts().tcp());
        Assertions.assertEquals(1833864756, model.pinholeTimeouts().udp());
        Assertions.assertEquals(1656493513, model.pinholeTimeouts().icmp());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        NaptConfiguration model =
            new NaptConfiguration()
                .withEnabled(NaptEnabled.DISABLED)
                .withPortRange(new PortRange().withMinPort(1991761310).withMaxPort(1674535960))
                .withPortReuseHoldTime(new PortReuseHoldTimes().withTcp(14804050).withUdp(2045600331))
                .withPinholeLimits(1132741350)
                .withPinholeTimeouts(
                    new PinholeTimeouts().withTcp(1617618462).withUdp(1833864756).withIcmp(1656493513));
        model = BinaryData.fromObject(model).toObject(NaptConfiguration.class);
        Assertions.assertEquals(NaptEnabled.DISABLED, model.enabled());
        Assertions.assertEquals(1991761310, model.portRange().minPort());
        Assertions.assertEquals(1674535960, model.portRange().maxPort());
        Assertions.assertEquals(14804050, model.portReuseHoldTime().tcp());
        Assertions.assertEquals(2045600331, model.portReuseHoldTime().udp());
        Assertions.assertEquals(1132741350, model.pinholeLimits());
        Assertions.assertEquals(1617618462, model.pinholeTimeouts().tcp());
        Assertions.assertEquals(1833864756, model.pinholeTimeouts().udp());
        Assertions.assertEquals(1656493513, model.pinholeTimeouts().icmp());
    }
}
