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

package com.azure.resourcemanager.managednetworkfabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.managednetworkfabric.fluent.models.L3IsolationDomainProperties;
import com.azure.resourcemanager.managednetworkfabric.models.AggregateRoute;
import com.azure.resourcemanager.managednetworkfabric.models.AggregateRouteConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy;
import com.azure.resourcemanager.managednetworkfabric.models.RedistributeConnectedSubnets;
import com.azure.resourcemanager.managednetworkfabric.models.RedistributeStaticRoutes;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class L3IsolationDomainPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        L3IsolationDomainProperties model =
            BinaryData
                .fromString(
                    "{\"networkFabricId\":\"bavxbniwdjswzt\",\"disabledOnResources\":[\"pgn\"],\"administrativeState\":\"Enabled\",\"optionBDisabledOnResources\":[\"pzxbz\",\"fzab\",\"lcuhxwtctyqiklb\"],\"provisioningState\":\"Updating\",\"redistributeConnectedSubnets\":\"False\",\"redistributeStaticRoutes\":\"False\",\"aggregateRouteConfiguration\":{\"ipv4Routes\":[{\"prefix\":\"yuguosvmkfssx\"},{\"prefix\":\"kkfpl\"}],\"ipv6Routes\":[{\"prefix\":\"xnkjzkdesl\"},{\"prefix\":\"lopwiyig\"},{\"prefix\":\"pkdwzbai\"},{\"prefix\":\"bbaumnyquped\"}]},\"description\":\"jn\",\"connectedSubnetRoutePolicy\":{\"exportRoutePolicyId\":\"khsmtxpsiebt\",\"administrativeState\":\"Disabled\"},\"annotation\":\"esap\"}")
                .toObject(L3IsolationDomainProperties.class);
        Assertions.assertEquals("esap", model.annotation());
        Assertions.assertEquals("bavxbniwdjswzt", model.networkFabricId());
        Assertions.assertEquals(RedistributeConnectedSubnets.FALSE, model.redistributeConnectedSubnets());
        Assertions.assertEquals(RedistributeStaticRoutes.FALSE, model.redistributeStaticRoutes());
        Assertions.assertEquals("yuguosvmkfssx", model.aggregateRouteConfiguration().ipv4Routes().get(0).prefix());
        Assertions.assertEquals("xnkjzkdesl", model.aggregateRouteConfiguration().ipv6Routes().get(0).prefix());
        Assertions.assertEquals("jn", model.description());
        Assertions.assertEquals("khsmtxpsiebt", model.connectedSubnetRoutePolicy().exportRoutePolicyId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        L3IsolationDomainProperties model =
            new L3IsolationDomainProperties()
                .withAnnotation("esap")
                .withNetworkFabricId("bavxbniwdjswzt")
                .withRedistributeConnectedSubnets(RedistributeConnectedSubnets.FALSE)
                .withRedistributeStaticRoutes(RedistributeStaticRoutes.FALSE)
                .withAggregateRouteConfiguration(
                    new AggregateRouteConfiguration()
                        .withIpv4Routes(
                            Arrays
                                .asList(
                                    new AggregateRoute().withPrefix("yuguosvmkfssx"),
                                    new AggregateRoute().withPrefix("kkfpl")))
                        .withIpv6Routes(
                            Arrays
                                .asList(
                                    new AggregateRoute().withPrefix("xnkjzkdesl"),
                                    new AggregateRoute().withPrefix("lopwiyig"),
                                    new AggregateRoute().withPrefix("pkdwzbai"),
                                    new AggregateRoute().withPrefix("bbaumnyquped"))))
                .withDescription("jn")
                .withConnectedSubnetRoutePolicy(
                    new L3IsolationDomainPatchPropertiesConnectedSubnetRoutePolicy()
                        .withExportRoutePolicyId("khsmtxpsiebt"));
        model = BinaryData.fromObject(model).toObject(L3IsolationDomainProperties.class);
        Assertions.assertEquals("esap", model.annotation());
        Assertions.assertEquals("bavxbniwdjswzt", model.networkFabricId());
        Assertions.assertEquals(RedistributeConnectedSubnets.FALSE, model.redistributeConnectedSubnets());
        Assertions.assertEquals(RedistributeStaticRoutes.FALSE, model.redistributeStaticRoutes());
        Assertions.assertEquals("yuguosvmkfssx", model.aggregateRouteConfiguration().ipv4Routes().get(0).prefix());
        Assertions.assertEquals("xnkjzkdesl", model.aggregateRouteConfiguration().ipv6Routes().get(0).prefix());
        Assertions.assertEquals("jn", model.description());
        Assertions.assertEquals("khsmtxpsiebt", model.connectedSubnetRoutePolicy().exportRoutePolicyId());
    }
}
