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

package com.azure.resourcemanager.managementgroups.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.managementgroups.fluent.models.EntityInfoProperties;
import com.azure.resourcemanager.managementgroups.models.EntityParentGroupInfo;
import com.azure.resourcemanager.managementgroups.models.Permissions;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class EntityInfoPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        EntityInfoProperties model =
            BinaryData
                .fromString(
                    "{\"tenantId\":\"twwrqp\",\"displayName\":\"dckzywbiexz\",\"parent\":{\"id\":\"ue\"},\"permissions\":\"noaccess\",\"inheritedPermissions\":\"delete\",\"numberOfDescendants\":735455048,\"numberOfChildren\":1281560612,\"numberOfChildGroups\":1589097578,\"parentDisplayNameChain\":[\"lmuzy\",\"xaepdkzjancuxr\",\"d\",\"bavxbniwdjswzt\"],\"parentNameChain\":[\"pgn\"]}")
                .toObject(EntityInfoProperties.class);
        Assertions.assertEquals("twwrqp", model.tenantId());
        Assertions.assertEquals("dckzywbiexz", model.displayName());
        Assertions.assertEquals("ue", model.parent().id());
        Assertions.assertEquals(Permissions.NOACCESS, model.permissions());
        Assertions.assertEquals(Permissions.DELETE, model.inheritedPermissions());
        Assertions.assertEquals(735455048, model.numberOfDescendants());
        Assertions.assertEquals(1281560612, model.numberOfChildren());
        Assertions.assertEquals(1589097578, model.numberOfChildGroups());
        Assertions.assertEquals("lmuzy", model.parentDisplayNameChain().get(0));
        Assertions.assertEquals("pgn", model.parentNameChain().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        EntityInfoProperties model =
            new EntityInfoProperties()
                .withTenantId("twwrqp")
                .withDisplayName("dckzywbiexz")
                .withParent(new EntityParentGroupInfo().withId("ue"))
                .withPermissions(Permissions.NOACCESS)
                .withInheritedPermissions(Permissions.DELETE)
                .withNumberOfDescendants(735455048)
                .withNumberOfChildren(1281560612)
                .withNumberOfChildGroups(1589097578)
                .withParentDisplayNameChain(Arrays.asList("lmuzy", "xaepdkzjancuxr", "d", "bavxbniwdjswzt"))
                .withParentNameChain(Arrays.asList("pgn"));
        model = BinaryData.fromObject(model).toObject(EntityInfoProperties.class);
        Assertions.assertEquals("twwrqp", model.tenantId());
        Assertions.assertEquals("dckzywbiexz", model.displayName());
        Assertions.assertEquals("ue", model.parent().id());
        Assertions.assertEquals(Permissions.NOACCESS, model.permissions());
        Assertions.assertEquals(Permissions.DELETE, model.inheritedPermissions());
        Assertions.assertEquals(735455048, model.numberOfDescendants());
        Assertions.assertEquals(1281560612, model.numberOfChildren());
        Assertions.assertEquals(1589097578, model.numberOfChildGroups());
        Assertions.assertEquals("lmuzy", model.parentDisplayNameChain().get(0));
        Assertions.assertEquals("pgn", model.parentNameChain().get(0));
    }
}
