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

package com.azure.resourcemanager.datalakeanalytics.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.datalakeanalytics.fluent.models.DataLakeAnalyticsAccountInner;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;

public final class DataLakeAnalyticsAccountInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        DataLakeAnalyticsAccountInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"defaultDataLakeStoreAccount\":\"ssainqpjwnzll\",\"dataLakeStoreAccounts\":[{\"name\":\"eebvmgxsab\",\"type\":\"qduujitcjczdz\",\"id\":\"ndhkrw\"},{\"name\":\"ppdsbdkvwrwj\",\"type\":\"usnhutje\",\"id\":\"mrldhu\"},{\"name\":\"zdatqxhocdg\",\"type\":\"blgphuticn\",\"id\":\"kao\"}],\"publicDataLakeStoreAccounts\":[{\"name\":\"tyhxhurokft\",\"type\":\"olniwpwcukjf\",\"id\":\"iawxklry\"},{\"name\":\"ckbasyypndd\",\"type\":\"gcbacphejkot\",\"id\":\"qgoulznd\"},{\"name\":\"wyqkgfgibm\",\"type\":\"gakeqsr\",\"id\":\"bzqqedqytbciq\"}],\"storageAccounts\":[{\"name\":\"mmnkzsmodmgl\",\"type\":\"gpbkwtmut\",\"id\":\"qktapspwgcuert\"},{\"name\":\"dosvqwhbmdgbbjf\",\"type\":\"gmbmbexppbh\",\"id\":\"qrolfpf\"}],\"computePolicies\":[{\"name\":\"bquxigjy\",\"type\":\"zjaoyfhrtxil\",\"id\":\"rkujy\"},{\"name\":\"eju\",\"type\":\"qawrlyxwj\",\"id\":\"prbnwbxgjvtbv\"},{\"name\":\"szdnr\",\"type\":\"qguhmuo\",\"id\":\"f\"},{\"name\":\"zw\",\"type\":\"g\",\"id\":\"tnwu\"}],\"hiveMetastores\":[{\"name\":\"x\",\"type\":\"izuckyfihrfidfvz\",\"id\":\"zuhtymwisdkfthwx\"},{\"name\":\"eiwaopvkmi\",\"type\":\"mmxdcu\",\"id\":\"fsrpymzidnse\"}],\"virtualNetworkRules\":[{\"name\":\"zsgfyccsnewmd\",\"type\":\"jeiachboosfl\",\"id\":\"osfqpteehzzv\"},{\"name\":\"qrimzinpv\",\"type\":\"jdkirsoodqx\",\"id\":\"rmnohj\"},{\"name\":\"whdsoifiyip\",\"type\":\"sqwpgrjb\",\"id\":\"orcjxvsnby\"},{\"name\":\"bnmo\",\"type\":\"cyshurzafbljjgp\",\"id\":\"oq\"}],\"firewallRules\":[{\"name\":\"javbqidtqajz\",\"type\":\"l\",\"id\":\"u\"},{\"name\":\"rlkhbzhfepgzgq\",\"type\":\"zloc\",\"id\":\"c\"}],\"firewallState\":\"Disabled\",\"firewallAllowAzureIps\":\"Enabled\",\"newTier\":\"Commitment_500000AUHours\",\"currentTier\":\"Commitment_5000AUHours\",\"maxJobCount\":539678864,\"maxActiveJobCountPerUser\":526297458,\"maxQueuedJobCountPerUser\":1936652093,\"maxJobRunningTimeInMin\":1786606148,\"systemMaxJobCount\":177005491,\"maxDegreeOfParallelism\":1703884652,\"systemMaxDegreeOfParallelism\":1291201271,\"maxDegreeOfParallelismPerJob\":2016183317,\"minPriorityPerJob\":547031215,\"queryStoreRetention\":1399700283,\"debugDataAccessLevel\":\"Customer\",\"accountId\":\"a2994310-8ed4-48d0-bfbe-b50f26da9a7e\",\"provisioningState\":\"Deleting\",\"state\":\"Suspended\",\"creationTime\":\"2021-01-11T15:15:23Z\",\"lastModifiedTime\":\"2021-02-09T00:09:24Z\",\"endpoint\":\"imexgstxgcpodgma\"},\"location\":\"jrmvdjwzrlo\",\"tags\":{\"qsycbkbfkgu\":\"lwhijcoejctbzaq\",\"axcfjpgddtocjjx\":\"dkexxppofm\",\"eojnxqbzvddn\":\"vpmouexhdzxib\",\"aoqvuh\":\"wndeicbtwnp\"},\"id\":\"hcffcyddglmjthjq\",\"name\":\"wpyeicxmqciwqvh\",\"type\":\"hix\"}")
                .toObject(DataLakeAnalyticsAccountInner.class);
        Assertions.assertEquals("jrmvdjwzrlo", model.location());
        Assertions.assertEquals("lwhijcoejctbzaq", model.tags().get("qsycbkbfkgu"));
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        DataLakeAnalyticsAccountInner model =
            new DataLakeAnalyticsAccountInner()
                .withLocation("jrmvdjwzrlo")
                .withTags(
                    mapOf(
                        "qsycbkbfkgu",
                        "lwhijcoejctbzaq",
                        "axcfjpgddtocjjx",
                        "dkexxppofm",
                        "eojnxqbzvddn",
                        "vpmouexhdzxib",
                        "aoqvuh",
                        "wndeicbtwnp"));
        model = BinaryData.fromObject(model).toObject(DataLakeAnalyticsAccountInner.class);
        Assertions.assertEquals("jrmvdjwzrlo", model.location());
        Assertions.assertEquals("lwhijcoejctbzaq", model.tags().get("qsycbkbfkgu"));
    }

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