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

package com.azure.resourcemanager.hybridcontainerservice.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.hybridcontainerservice.fluent.models.ProvisionedClustersResponseInner;
import com.azure.resourcemanager.hybridcontainerservice.models.AadProfileResponse;
import com.azure.resourcemanager.hybridcontainerservice.models.AddonProfiles;
import com.azure.resourcemanager.hybridcontainerservice.models.CloudProviderProfile;
import com.azure.resourcemanager.hybridcontainerservice.models.ControlPlaneProfile;
import com.azure.resourcemanager.hybridcontainerservice.models.HttpProxyConfigResponse;
import com.azure.resourcemanager.hybridcontainerservice.models.LicenseType;
import com.azure.resourcemanager.hybridcontainerservice.models.LinuxProfileProperties;
import com.azure.resourcemanager.hybridcontainerservice.models.LoadBalancerSku;
import com.azure.resourcemanager.hybridcontainerservice.models.Mode;
import com.azure.resourcemanager.hybridcontainerservice.models.NamedAgentPoolProfile;
import com.azure.resourcemanager.hybridcontainerservice.models.NetworkPolicy;
import com.azure.resourcemanager.hybridcontainerservice.models.NetworkProfile;
import com.azure.resourcemanager.hybridcontainerservice.models.OsType;
import com.azure.resourcemanager.hybridcontainerservice.models.ProvisionedClusterIdentity;
import com.azure.resourcemanager.hybridcontainerservice.models.ProvisionedClustersCommonPropertiesFeatures;
import com.azure.resourcemanager.hybridcontainerservice.models.ProvisionedClustersResponseExtendedLocation;
import com.azure.resourcemanager.hybridcontainerservice.models.ProvisionedClustersResponseProperties;
import com.azure.resourcemanager.hybridcontainerservice.models.ResourceIdentityType;
import com.azure.resourcemanager.hybridcontainerservice.models.WindowsProfileResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;

public final class ProvisionedClustersResponseInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ProvisionedClustersResponseInner model =
            BinaryData
                .fromString(
                    "{\"identity\":{\"principalId\":\"hq\",\"tenantId\":\"gjxpybczmehmt\",\"type\":\"None\"},\"properties\":{\"enableRbac\":true,\"linuxProfile\":{\"adminUsername\":\"rupidgsyb\"},\"features\":{},\"addonProfiles\":{\"msxaobhd\":{\"config\":{},\"enabled\":true},\"qioqjzehtbmu\":{\"config\":{},\"enabled\":false}},\"controlPlane\":{\"name\":\"oizh\",\"count\":1967933991,\"availabilityZones\":[\"bqsoqijg\",\"dmbpazlobcufpdz\",\"rbt\"],\"maxCount\":1897001244,\"maxPods\":332258178,\"minCount\":1110459096,\"mode\":\"System\",\"nodeLabels\":{\"ojywifsqesa\":\"nufo\",\"glzlhjxrifkwmrv\":\"gdf\"},\"nodeTaints\":[\"izntocipao\",\"ajpsquc\"],\"osType\":\"Linux\",\"nodeImageVersion\":\"fdkfogk\",\"vmSize\":\"gjofjd\"},\"kubernetesVersion\":\"s\",\"networkProfile\":{\"loadBalancerSku\":\"stacked-kube-vip\",\"dnsServiceIP\":\"wnw\",\"networkPolicy\":\"calico\",\"podCidr\":\"jzyflu\",\"podCidrs\":[\"hmofc\"],\"serviceCidr\":\"smy\",\"serviceCidrs\":[\"dtmlxhekuksjt\",\"ukcdmparcryuanzw\",\"xzdxtayrlhmwh\"]},\"nodeResourceGroup\":\"mrqobmtukknr\",\"agentPoolProfiles\":[{\"name\":\"hfx\",\"count\":1273684509,\"availabilityZones\":[],\"maxCount\":1842120310,\"maxPods\":1304253774,\"minCount\":1041467339,\"mode\":\"User\",\"nodeLabels\":{},\"nodeTaints\":[],\"osType\":\"Windows\",\"nodeImageVersion\":\"uf\",\"vmSize\":\"zk\"},{\"name\":\"bihanuf\",\"count\":808084535,\"availabilityZones\":[],\"maxCount\":43632750,\"maxPods\":173106164,\"minCount\":987241828,\"mode\":\"LB\",\"nodeLabels\":{},\"nodeTaints\":[],\"osType\":\"Windows\",\"nodeImageVersion\":\"ifpikxwczby\",\"vmSize\":\"npqxuh\"}],\"cloudProviderProfile\":{},\"provisioningState\":\"Failed\",\"status\":{\"addonStatus\":{},\"errorMessage\":\"xvd\"},\"aadProfile\":{\"adminGroupObjectIDs\":[\"tfwvukxgaudc\"],\"clientAppID\":\"nhsjcnyej\",\"enableAzureRbac\":true,\"managed\":true,\"serverAppID\":\"napczwlokjy\",\"tenantID\":\"kkvnipjox\"},\"windowsProfile\":{\"adminUsername\":\"chgejspodm\",\"enableCsiProxy\":true,\"licenseType\":\"Windows_Server\"},\"httpProxyConfig\":{\"httpProxy\":\"h\",\"httpsProxy\":\"wyahuxinpmqnja\",\"noProxy\":[\"xj\",\"prozvcputegjvwmf\",\"atscmd\",\"pjhulsuuvmkj\"],\"trustedCa\":\"k\",\"username\":\"f\"}},\"extendedLocation\":{\"type\":\"djpslw\",\"name\":\"dpvwryoqpsoaccta\"},\"location\":\"akl\",\"tags\":{\"paojakhmsbzjh\":\"hbcryffdfdosyge\"},\"id\":\"rzevdphlxaol\",\"name\":\"hqtrgqjbpf\",\"type\":\"fsinzgvfcjrwzoxx\"}")
                .toObject(ProvisionedClustersResponseInner.class);
        Assertions.assertEquals("akl", model.location());
        Assertions.assertEquals("hbcryffdfdosyge", model.tags().get("paojakhmsbzjh"));
        Assertions.assertEquals(ResourceIdentityType.NONE, model.identity().type());
        Assertions.assertEquals("tfwvukxgaudc", model.properties().aadProfile().adminGroupObjectIDs().get(0));
        Assertions.assertEquals("nhsjcnyej", model.properties().aadProfile().clientAppId());
        Assertions.assertEquals(true, model.properties().aadProfile().enableAzureRbac());
        Assertions.assertEquals(true, model.properties().aadProfile().managed());
        Assertions.assertEquals("napczwlokjy", model.properties().aadProfile().serverAppId());
        Assertions.assertEquals("kkvnipjox", model.properties().aadProfile().tenantId());
        Assertions.assertEquals("chgejspodm", model.properties().windowsProfile().adminUsername());
        Assertions.assertEquals(true, model.properties().windowsProfile().enableCsiProxy());
        Assertions.assertEquals(LicenseType.WINDOWS_SERVER, model.properties().windowsProfile().licenseType());
        Assertions.assertEquals("h", model.properties().httpProxyConfig().httpProxy());
        Assertions.assertEquals("wyahuxinpmqnja", model.properties().httpProxyConfig().httpsProxy());
        Assertions.assertEquals("xj", model.properties().httpProxyConfig().noProxy().get(0));
        Assertions.assertEquals("k", model.properties().httpProxyConfig().trustedCa());
        Assertions.assertEquals("f", model.properties().httpProxyConfig().username());
        Assertions.assertEquals(true, model.properties().enableRbac());
        Assertions.assertEquals("rupidgsyb", model.properties().linuxProfile().adminUsername());
        Assertions.assertEquals(true, model.properties().addonProfiles().get("msxaobhd").enabled());
        Assertions.assertEquals(1967933991, model.properties().controlPlane().count());
        Assertions.assertEquals("bqsoqijg", model.properties().controlPlane().availabilityZones().get(0));
        Assertions.assertEquals(1897001244, model.properties().controlPlane().maxCount());
        Assertions.assertEquals(332258178, model.properties().controlPlane().maxPods());
        Assertions.assertEquals(1110459096, model.properties().controlPlane().minCount());
        Assertions.assertEquals(Mode.SYSTEM, model.properties().controlPlane().mode());
        Assertions.assertEquals("nufo", model.properties().controlPlane().nodeLabels().get("ojywifsqesa"));
        Assertions.assertEquals("izntocipao", model.properties().controlPlane().nodeTaints().get(0));
        Assertions.assertEquals(OsType.LINUX, model.properties().controlPlane().osType());
        Assertions.assertEquals("fdkfogk", model.properties().controlPlane().nodeImageVersion());
        Assertions.assertEquals("gjofjd", model.properties().controlPlane().vmSize());
        Assertions.assertEquals("oizh", model.properties().controlPlane().name());
        Assertions.assertEquals("s", model.properties().kubernetesVersion());
        Assertions
            .assertEquals(LoadBalancerSku.STACKED_KUBE_VIP, model.properties().networkProfile().loadBalancerSku());
        Assertions.assertEquals("wnw", model.properties().networkProfile().dnsServiceIp());
        Assertions.assertEquals(NetworkPolicy.CALICO, model.properties().networkProfile().networkPolicy());
        Assertions.assertEquals("jzyflu", model.properties().networkProfile().podCidr());
        Assertions.assertEquals("hmofc", model.properties().networkProfile().podCidrs().get(0));
        Assertions.assertEquals("smy", model.properties().networkProfile().serviceCidr());
        Assertions.assertEquals("dtmlxhekuksjt", model.properties().networkProfile().serviceCidrs().get(0));
        Assertions.assertEquals("mrqobmtukknr", model.properties().nodeResourceGroup());
        Assertions.assertEquals(1273684509, model.properties().agentPoolProfiles().get(0).count());
        Assertions.assertEquals(1842120310, model.properties().agentPoolProfiles().get(0).maxCount());
        Assertions.assertEquals(1304253774, model.properties().agentPoolProfiles().get(0).maxPods());
        Assertions.assertEquals(1041467339, model.properties().agentPoolProfiles().get(0).minCount());
        Assertions.assertEquals(Mode.USER, model.properties().agentPoolProfiles().get(0).mode());
        Assertions.assertEquals(OsType.WINDOWS, model.properties().agentPoolProfiles().get(0).osType());
        Assertions.assertEquals("uf", model.properties().agentPoolProfiles().get(0).nodeImageVersion());
        Assertions.assertEquals("zk", model.properties().agentPoolProfiles().get(0).vmSize());
        Assertions.assertEquals("hfx", model.properties().agentPoolProfiles().get(0).name());
        Assertions.assertEquals("djpslw", model.extendedLocation().type());
        Assertions.assertEquals("dpvwryoqpsoaccta", model.extendedLocation().name());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ProvisionedClustersResponseInner model =
            new ProvisionedClustersResponseInner()
                .withLocation("akl")
                .withTags(mapOf("paojakhmsbzjh", "hbcryffdfdosyge"))
                .withIdentity(new ProvisionedClusterIdentity().withType(ResourceIdentityType.NONE))
                .withProperties(
                    new ProvisionedClustersResponseProperties()
                        .withAadProfile(
                            new AadProfileResponse()
                                .withAdminGroupObjectIDs(Arrays.asList("tfwvukxgaudc"))
                                .withClientAppId("nhsjcnyej")
                                .withEnableAzureRbac(true)
                                .withManaged(true)
                                .withServerAppId("napczwlokjy")
                                .withTenantId("kkvnipjox"))
                        .withWindowsProfile(
                            new WindowsProfileResponse()
                                .withAdminUsername("chgejspodm")
                                .withEnableCsiProxy(true)
                                .withLicenseType(LicenseType.WINDOWS_SERVER))
                        .withHttpProxyConfig(
                            new HttpProxyConfigResponse()
                                .withHttpProxy("h")
                                .withHttpsProxy("wyahuxinpmqnja")
                                .withNoProxy(Arrays.asList("xj", "prozvcputegjvwmf", "atscmd", "pjhulsuuvmkj"))
                                .withTrustedCa("k")
                                .withUsername("f"))
                        .withEnableRbac(true)
                        .withLinuxProfile(new LinuxProfileProperties().withAdminUsername("rupidgsyb"))
                        .withFeatures(new ProvisionedClustersCommonPropertiesFeatures())
                        .withAddonProfiles(
                            mapOf(
                                "msxaobhd",
                                new AddonProfiles().withConfig(mapOf()).withEnabled(true),
                                "qioqjzehtbmu",
                                new AddonProfiles().withConfig(mapOf()).withEnabled(false)))
                        .withControlPlane(
                            new ControlPlaneProfile()
                                .withCount(1967933991)
                                .withAvailabilityZones(Arrays.asList("bqsoqijg", "dmbpazlobcufpdz", "rbt"))
                                .withMaxCount(1897001244)
                                .withMaxPods(332258178)
                                .withMinCount(1110459096)
                                .withMode(Mode.SYSTEM)
                                .withNodeLabels(mapOf("ojywifsqesa", "nufo", "glzlhjxrifkwmrv", "gdf"))
                                .withNodeTaints(Arrays.asList("izntocipao", "ajpsquc"))
                                .withOsType(OsType.LINUX)
                                .withNodeImageVersion("fdkfogk")
                                .withVmSize("gjofjd")
                                .withName("oizh"))
                        .withKubernetesVersion("s")
                        .withNetworkProfile(
                            new NetworkProfile()
                                .withLoadBalancerSku(LoadBalancerSku.STACKED_KUBE_VIP)
                                .withDnsServiceIp("wnw")
                                .withNetworkPolicy(NetworkPolicy.CALICO)
                                .withPodCidr("jzyflu")
                                .withPodCidrs(Arrays.asList("hmofc"))
                                .withServiceCidr("smy")
                                .withServiceCidrs(Arrays.asList("dtmlxhekuksjt", "ukcdmparcryuanzw", "xzdxtayrlhmwh")))
                        .withNodeResourceGroup("mrqobmtukknr")
                        .withAgentPoolProfiles(
                            Arrays
                                .asList(
                                    new NamedAgentPoolProfile()
                                        .withCount(1273684509)
                                        .withAvailabilityZones(Arrays.asList())
                                        .withMaxCount(1842120310)
                                        .withMaxPods(1304253774)
                                        .withMinCount(1041467339)
                                        .withMode(Mode.USER)
                                        .withNodeLabels(mapOf())
                                        .withNodeTaints(Arrays.asList())
                                        .withOsType(OsType.WINDOWS)
                                        .withNodeImageVersion("uf")
                                        .withVmSize("zk")
                                        .withName("hfx"),
                                    new NamedAgentPoolProfile()
                                        .withCount(808084535)
                                        .withAvailabilityZones(Arrays.asList())
                                        .withMaxCount(43632750)
                                        .withMaxPods(173106164)
                                        .withMinCount(987241828)
                                        .withMode(Mode.LB)
                                        .withNodeLabels(mapOf())
                                        .withNodeTaints(Arrays.asList())
                                        .withOsType(OsType.WINDOWS)
                                        .withNodeImageVersion("ifpikxwczby")
                                        .withVmSize("npqxuh")
                                        .withName("bihanuf")))
                        .withCloudProviderProfile(new CloudProviderProfile()))
                .withExtendedLocation(
                    new ProvisionedClustersResponseExtendedLocation().withType("djpslw").withName("dpvwryoqpsoaccta"));
        model = BinaryData.fromObject(model).toObject(ProvisionedClustersResponseInner.class);
        Assertions.assertEquals("akl", model.location());
        Assertions.assertEquals("hbcryffdfdosyge", model.tags().get("paojakhmsbzjh"));
        Assertions.assertEquals(ResourceIdentityType.NONE, model.identity().type());
        Assertions.assertEquals("tfwvukxgaudc", model.properties().aadProfile().adminGroupObjectIDs().get(0));
        Assertions.assertEquals("nhsjcnyej", model.properties().aadProfile().clientAppId());
        Assertions.assertEquals(true, model.properties().aadProfile().enableAzureRbac());
        Assertions.assertEquals(true, model.properties().aadProfile().managed());
        Assertions.assertEquals("napczwlokjy", model.properties().aadProfile().serverAppId());
        Assertions.assertEquals("kkvnipjox", model.properties().aadProfile().tenantId());
        Assertions.assertEquals("chgejspodm", model.properties().windowsProfile().adminUsername());
        Assertions.assertEquals(true, model.properties().windowsProfile().enableCsiProxy());
        Assertions.assertEquals(LicenseType.WINDOWS_SERVER, model.properties().windowsProfile().licenseType());
        Assertions.assertEquals("h", model.properties().httpProxyConfig().httpProxy());
        Assertions.assertEquals("wyahuxinpmqnja", model.properties().httpProxyConfig().httpsProxy());
        Assertions.assertEquals("xj", model.properties().httpProxyConfig().noProxy().get(0));
        Assertions.assertEquals("k", model.properties().httpProxyConfig().trustedCa());
        Assertions.assertEquals("f", model.properties().httpProxyConfig().username());
        Assertions.assertEquals(true, model.properties().enableRbac());
        Assertions.assertEquals("rupidgsyb", model.properties().linuxProfile().adminUsername());
        Assertions.assertEquals(true, model.properties().addonProfiles().get("msxaobhd").enabled());
        Assertions.assertEquals(1967933991, model.properties().controlPlane().count());
        Assertions.assertEquals("bqsoqijg", model.properties().controlPlane().availabilityZones().get(0));
        Assertions.assertEquals(1897001244, model.properties().controlPlane().maxCount());
        Assertions.assertEquals(332258178, model.properties().controlPlane().maxPods());
        Assertions.assertEquals(1110459096, model.properties().controlPlane().minCount());
        Assertions.assertEquals(Mode.SYSTEM, model.properties().controlPlane().mode());
        Assertions.assertEquals("nufo", model.properties().controlPlane().nodeLabels().get("ojywifsqesa"));
        Assertions.assertEquals("izntocipao", model.properties().controlPlane().nodeTaints().get(0));
        Assertions.assertEquals(OsType.LINUX, model.properties().controlPlane().osType());
        Assertions.assertEquals("fdkfogk", model.properties().controlPlane().nodeImageVersion());
        Assertions.assertEquals("gjofjd", model.properties().controlPlane().vmSize());
        Assertions.assertEquals("oizh", model.properties().controlPlane().name());
        Assertions.assertEquals("s", model.properties().kubernetesVersion());
        Assertions
            .assertEquals(LoadBalancerSku.STACKED_KUBE_VIP, model.properties().networkProfile().loadBalancerSku());
        Assertions.assertEquals("wnw", model.properties().networkProfile().dnsServiceIp());
        Assertions.assertEquals(NetworkPolicy.CALICO, model.properties().networkProfile().networkPolicy());
        Assertions.assertEquals("jzyflu", model.properties().networkProfile().podCidr());
        Assertions.assertEquals("hmofc", model.properties().networkProfile().podCidrs().get(0));
        Assertions.assertEquals("smy", model.properties().networkProfile().serviceCidr());
        Assertions.assertEquals("dtmlxhekuksjt", model.properties().networkProfile().serviceCidrs().get(0));
        Assertions.assertEquals("mrqobmtukknr", model.properties().nodeResourceGroup());
        Assertions.assertEquals(1273684509, model.properties().agentPoolProfiles().get(0).count());
        Assertions.assertEquals(1842120310, model.properties().agentPoolProfiles().get(0).maxCount());
        Assertions.assertEquals(1304253774, model.properties().agentPoolProfiles().get(0).maxPods());
        Assertions.assertEquals(1041467339, model.properties().agentPoolProfiles().get(0).minCount());
        Assertions.assertEquals(Mode.USER, model.properties().agentPoolProfiles().get(0).mode());
        Assertions.assertEquals(OsType.WINDOWS, model.properties().agentPoolProfiles().get(0).osType());
        Assertions.assertEquals("uf", model.properties().agentPoolProfiles().get(0).nodeImageVersion());
        Assertions.assertEquals("zk", model.properties().agentPoolProfiles().get(0).vmSize());
        Assertions.assertEquals("hfx", model.properties().agentPoolProfiles().get(0).name());
        Assertions.assertEquals("djpslw", model.extendedLocation().type());
        Assertions.assertEquals("dpvwryoqpsoaccta", model.extendedLocation().name());
    }

    @SuppressWarnings("unchecked")
    private static <T> Map<String, T> mapOf(Object... inputs) {
        Map<String, T> map = new HashMap<>();
        for (int i = 0; i < inputs.length; i += 2) {
            String key = (String) inputs[i];
            T value = (T) inputs[i + 1];
            map.put(key, value);
        }
        return map;
    }
}
