// 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.models.AgentPoolProfile;
import com.azure.resourcemanager.hybridcontainerservice.models.CloudProviderProfile;
import com.azure.resourcemanager.hybridcontainerservice.models.CloudProviderProfileInfraNetworkProfile;
import com.azure.resourcemanager.hybridcontainerservice.models.CloudProviderProfileInfraStorageProfile;
import com.azure.resourcemanager.hybridcontainerservice.models.Mode;
import com.azure.resourcemanager.hybridcontainerservice.models.OsType;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;

public final class AgentPoolProfileTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AgentPoolProfile model =
            BinaryData
                .fromString(
                    "{\"count\":811282573,\"availabilityZones\":[\"rimz\",\"npvswjdkirso\",\"dqxhcrmnohjtckwh\"],\"maxCount\":1629637737,\"maxPods\":1580515344,\"minCount\":614073164,\"mode\":\"System\",\"nodeLabels\":{\"norcjxvsnbyxqab\":\"sqwpgrjb\",\"shurzafbljjgpbto\":\"mocpc\",\"mkljavb\":\"c\",\"pku\":\"idtqajzyu\"},\"nodeTaints\":[\"rlkhbzhfepgzgq\",\"xzlocxscp\",\"ierhhbcsglummaj\"],\"osType\":\"Linux\",\"nodeImageVersion\":\"dxob\",\"vmSize\":\"dxkqpx\",\"cloudProviderProfile\":{\"infraNetworkProfile\":{\"vnetSubnetIds\":[\"onpimexgstxg\",\"po\",\"gmaajrm\"]},\"infraStorageProfile\":{\"storageSpaceIds\":[\"zrlovmclwhijcoej\",\"tbzaqsqsycbkbfk\",\"ukdkexxppofmxa\",\"c\"]}}}")
                .toObject(AgentPoolProfile.class);
        Assertions.assertEquals(811282573, model.count());
        Assertions.assertEquals("rimz", model.availabilityZones().get(0));
        Assertions.assertEquals(1629637737, model.maxCount());
        Assertions.assertEquals(1580515344, model.maxPods());
        Assertions.assertEquals(614073164, model.minCount());
        Assertions.assertEquals(Mode.SYSTEM, model.mode());
        Assertions.assertEquals("sqwpgrjb", model.nodeLabels().get("norcjxvsnbyxqab"));
        Assertions.assertEquals("rlkhbzhfepgzgq", model.nodeTaints().get(0));
        Assertions.assertEquals(OsType.LINUX, model.osType());
        Assertions.assertEquals("dxob", model.nodeImageVersion());
        Assertions.assertEquals("dxkqpx", model.vmSize());
        Assertions
            .assertEquals("onpimexgstxg", model.cloudProviderProfile().infraNetworkProfile().vnetSubnetIds().get(0));
        Assertions
            .assertEquals(
                "zrlovmclwhijcoej", model.cloudProviderProfile().infraStorageProfile().storageSpaceIds().get(0));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AgentPoolProfile model =
            new AgentPoolProfile()
                .withCount(811282573)
                .withAvailabilityZones(Arrays.asList("rimz", "npvswjdkirso", "dqxhcrmnohjtckwh"))
                .withMaxCount(1629637737)
                .withMaxPods(1580515344)
                .withMinCount(614073164)
                .withMode(Mode.SYSTEM)
                .withNodeLabels(
                    mapOf(
                        "norcjxvsnbyxqab", "sqwpgrjb", "shurzafbljjgpbto", "mocpc", "mkljavb", "c", "pku", "idtqajzyu"))
                .withNodeTaints(Arrays.asList("rlkhbzhfepgzgq", "xzlocxscp", "ierhhbcsglummaj"))
                .withOsType(OsType.LINUX)
                .withNodeImageVersion("dxob")
                .withVmSize("dxkqpx")
                .withCloudProviderProfile(
                    new CloudProviderProfile()
                        .withInfraNetworkProfile(
                            new CloudProviderProfileInfraNetworkProfile()
                                .withVnetSubnetIds(Arrays.asList("onpimexgstxg", "po", "gmaajrm")))
                        .withInfraStorageProfile(
                            new CloudProviderProfileInfraStorageProfile()
                                .withStorageSpaceIds(
                                    Arrays.asList("zrlovmclwhijcoej", "tbzaqsqsycbkbfk", "ukdkexxppofmxa", "c"))));
        model = BinaryData.fromObject(model).toObject(AgentPoolProfile.class);
        Assertions.assertEquals(811282573, model.count());
        Assertions.assertEquals("rimz", model.availabilityZones().get(0));
        Assertions.assertEquals(1629637737, model.maxCount());
        Assertions.assertEquals(1580515344, model.maxPods());
        Assertions.assertEquals(614073164, model.minCount());
        Assertions.assertEquals(Mode.SYSTEM, model.mode());
        Assertions.assertEquals("sqwpgrjb", model.nodeLabels().get("norcjxvsnbyxqab"));
        Assertions.assertEquals("rlkhbzhfepgzgq", model.nodeTaints().get(0));
        Assertions.assertEquals(OsType.LINUX, model.osType());
        Assertions.assertEquals("dxob", model.nodeImageVersion());
        Assertions.assertEquals("dxkqpx", model.vmSize());
        Assertions
            .assertEquals("onpimexgstxg", model.cloudProviderProfile().infraNetworkProfile().vnetSubnetIds().get(0));
        Assertions
            .assertEquals(
                "zrlovmclwhijcoej", model.cloudProviderProfile().infraStorageProfile().storageSpaceIds().get(0));
    }

    @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;
    }
}
