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

package com.azure.resourcemanager.mixedreality.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mixedreality.fluent.models.RemoteRenderingAccountInner;
import com.azure.resourcemanager.mixedreality.models.Identity;
import com.azure.resourcemanager.mixedreality.models.RemoteRenderingAccountPage;
import com.azure.resourcemanager.mixedreality.models.ResourceIdentityType;
import com.azure.resourcemanager.mixedreality.models.Sku;
import com.azure.resourcemanager.mixedreality.models.SkuTier;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;

public final class RemoteRenderingAccountPageTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        RemoteRenderingAccountPage model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"storageAccountName\":\"debfqkkrbmpukgri\",\"accountId\":\"lzlfbxzpuz\",\"accountDomain\":\"ispnqzahmgkbrp\"},\"identity\":{\"principalId\":\"hibnuqqkpika\",\"tenantId\":\"gvtqagnbuynh\",\"type\":\"SystemAssigned\"},\"plan\":{\"principalId\":\"ebf\",\"tenantId\":\"arbu\",\"type\":\"SystemAssigned\"},\"sku\":{\"name\":\"pnazzm\",\"tier\":\"Basic\",\"size\":\"nmpxttdb\",\"family\":\"bnlankxmyskpb\",\"capacity\":1074926668},\"kind\":{\"name\":\"tkcxywnytnrsy\",\"tier\":\"Basic\",\"size\":\"dybyxczfclhaa\",\"family\":\"babphlwrqlfk\",\"capacity\":1003967781},\"location\":\"sucocmnyyazttbtw\",\"tags\":{\"yueaxibxujwb\":\"puedckzywbiexzf\",\"zjancuxr\":\"qwalmuzyoxaepd\",\"bavxbniwdjswzt\":\"d\",\"xbzpfzab\":\"dbpgnxytxhp\"},\"id\":\"lcuhxwtctyqiklb\",\"name\":\"ovplw\",\"type\":\"bhvgy\"},{\"properties\":{\"storageAccountName\":\"osvmk\",\"accountId\":\"sxqu\",\"accountDomain\":\"fpl\"},\"identity\":{\"principalId\":\"sxnkjzkdeslpvlo\",\"tenantId\":\"i\",\"type\":\"SystemAssigned\"},\"plan\":{\"principalId\":\"pkdwzbai\",\"tenantId\":\"bbaumnyquped\",\"type\":\"SystemAssigned\"},\"sku\":{\"name\":\"a\",\"tier\":\"Standard\",\"size\":\"smtxpsieb\",\"family\":\"hvpesapskrdqm\",\"capacity\":1058725142},\"kind\":{\"name\":\"htldwk\",\"tier\":\"Premium\",\"size\":\"utknc\",\"family\":\"cwsvlxotog\",\"capacity\":918188408},\"location\":\"pqsxvnmicy\",\"tags\":{\"fcnj\":\"eoveilovnotyf\",\"nxdhbt\":\"k\",\"nermcl\":\"kphywpnvjto\"},\"id\":\"plpho\",\"name\":\"uscrpabgyepsb\",\"type\":\"tazqugxywpmueefj\"},{\"properties\":{\"storageAccountName\":\"qkqujidsu\",\"accountId\":\"nobglaocq\",\"accountDomain\":\"ccm\"},\"identity\":{\"principalId\":\"dxyt\",\"tenantId\":\"oyrxvwfudwpzntxh\",\"type\":\"SystemAssigned\"},\"plan\":{\"principalId\":\"qj\",\"tenantId\":\"ck\",\"type\":\"SystemAssigned\"},\"sku\":{\"name\":\"rxsbkyvp\",\"tier\":\"Premium\",\"size\":\"uzbpzkafku\",\"family\":\"crnwbmeh\",\"capacity\":2008133985},\"kind\":{\"name\":\"v\",\"tier\":\"Premium\",\"size\":\"tslhspkdeem\",\"family\":\"fm\",\"capacity\":1437529213},\"location\":\"vt\",\"tags\":{\"c\":\"mqkrhahvljuahaqu\",\"aex\":\"hmdua\",\"vxpvgomz\":\"pvfadmwsrcr\"},\"id\":\"fmisg\",\"name\":\"bnbbeldawkz\",\"type\":\"ali\"},{\"properties\":{\"storageAccountName\":\"qhakauhashsf\",\"accountId\":\"osow\",\"accountDomain\":\"cugicjoox\"},\"identity\":{\"principalId\":\"bwpucwwfvovbv\",\"tenantId\":\"uecivyhz\",\"type\":\"SystemAssigned\"},\"plan\":{\"principalId\":\"gjrwjueiotwmcdyt\",\"tenantId\":\"wit\",\"type\":\"SystemAssigned\"},\"sku\":{\"name\":\"awgqwgxhni\",\"tier\":\"Free\",\"size\":\"bkpyc\",\"family\":\"lwn\",\"capacity\":1035502887},\"kind\":{\"name\":\"dauwhvylwzbtd\",\"tier\":\"Basic\",\"size\":\"znbmpowuwprzq\",\"family\":\"eualupjmkhf\",\"capacity\":768618296},\"location\":\"cswsrtjri\",\"tags\":{\"c\":\"bpbewtghfgb\",\"gibtnm\":\"wxzvlvqhjkb\",\"j\":\"iebwwaloayqcgwrt\",\"yzm\":\"zg\"},\"id\":\"txon\",\"name\":\"mtsavjcbpwxqp\",\"type\":\"rknftguvriuhprwm\"}],\"nextLink\":\"vxqtayriwwroyqbe\"}")
                .toObject(RemoteRenderingAccountPage.class);
        Assertions.assertEquals("sucocmnyyazttbtw", model.value().get(0).location());
        Assertions.assertEquals("puedckzywbiexzf", model.value().get(0).tags().get("yueaxibxujwb"));
        Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type());
        Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).plan().type());
        Assertions.assertEquals("pnazzm", model.value().get(0).sku().name());
        Assertions.assertEquals(SkuTier.BASIC, model.value().get(0).sku().tier());
        Assertions.assertEquals("nmpxttdb", model.value().get(0).sku().size());
        Assertions.assertEquals("bnlankxmyskpb", model.value().get(0).sku().family());
        Assertions.assertEquals(1074926668, model.value().get(0).sku().capacity());
        Assertions.assertEquals("tkcxywnytnrsy", model.value().get(0).kind().name());
        Assertions.assertEquals(SkuTier.BASIC, model.value().get(0).kind().tier());
        Assertions.assertEquals("dybyxczfclhaa", model.value().get(0).kind().size());
        Assertions.assertEquals("babphlwrqlfk", model.value().get(0).kind().family());
        Assertions.assertEquals(1003967781, model.value().get(0).kind().capacity());
        Assertions.assertEquals("debfqkkrbmpukgri", model.value().get(0).storageAccountName());
        Assertions.assertEquals("vxqtayriwwroyqbe", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        RemoteRenderingAccountPage model =
            new RemoteRenderingAccountPage()
                .withValue(
                    Arrays
                        .asList(
                            new RemoteRenderingAccountInner()
                                .withLocation("sucocmnyyazttbtw")
                                .withTags(
                                    mapOf(
                                        "yueaxibxujwb",
                                        "puedckzywbiexzf",
                                        "zjancuxr",
                                        "qwalmuzyoxaepd",
                                        "bavxbniwdjswzt",
                                        "d",
                                        "xbzpfzab",
                                        "dbpgnxytxhp"))
                                .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
                                .withPlan(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
                                .withSku(
                                    new Sku()
                                        .withName("pnazzm")
                                        .withTier(SkuTier.BASIC)
                                        .withSize("nmpxttdb")
                                        .withFamily("bnlankxmyskpb")
                                        .withCapacity(1074926668))
                                .withKind(
                                    new Sku()
                                        .withName("tkcxywnytnrsy")
                                        .withTier(SkuTier.BASIC)
                                        .withSize("dybyxczfclhaa")
                                        .withFamily("babphlwrqlfk")
                                        .withCapacity(1003967781))
                                .withStorageAccountName("debfqkkrbmpukgri"),
                            new RemoteRenderingAccountInner()
                                .withLocation("pqsxvnmicy")
                                .withTags(mapOf("fcnj", "eoveilovnotyf", "nxdhbt", "k", "nermcl", "kphywpnvjto"))
                                .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
                                .withPlan(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
                                .withSku(
                                    new Sku()
                                        .withName("a")
                                        .withTier(SkuTier.STANDARD)
                                        .withSize("smtxpsieb")
                                        .withFamily("hvpesapskrdqm")
                                        .withCapacity(1058725142))
                                .withKind(
                                    new Sku()
                                        .withName("htldwk")
                                        .withTier(SkuTier.PREMIUM)
                                        .withSize("utknc")
                                        .withFamily("cwsvlxotog")
                                        .withCapacity(918188408))
                                .withStorageAccountName("osvmk"),
                            new RemoteRenderingAccountInner()
                                .withLocation("vt")
                                .withTags(mapOf("c", "mqkrhahvljuahaqu", "aex", "hmdua", "vxpvgomz", "pvfadmwsrcr"))
                                .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
                                .withPlan(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
                                .withSku(
                                    new Sku()
                                        .withName("rxsbkyvp")
                                        .withTier(SkuTier.PREMIUM)
                                        .withSize("uzbpzkafku")
                                        .withFamily("crnwbmeh")
                                        .withCapacity(2008133985))
                                .withKind(
                                    new Sku()
                                        .withName("v")
                                        .withTier(SkuTier.PREMIUM)
                                        .withSize("tslhspkdeem")
                                        .withFamily("fm")
                                        .withCapacity(1437529213))
                                .withStorageAccountName("qkqujidsu"),
                            new RemoteRenderingAccountInner()
                                .withLocation("cswsrtjri")
                                .withTags(
                                    mapOf(
                                        "c",
                                        "bpbewtghfgb",
                                        "gibtnm",
                                        "wxzvlvqhjkb",
                                        "j",
                                        "iebwwaloayqcgwrt",
                                        "yzm",
                                        "zg"))
                                .withIdentity(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
                                .withPlan(new Identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
                                .withSku(
                                    new Sku()
                                        .withName("awgqwgxhni")
                                        .withTier(SkuTier.FREE)
                                        .withSize("bkpyc")
                                        .withFamily("lwn")
                                        .withCapacity(1035502887))
                                .withKind(
                                    new Sku()
                                        .withName("dauwhvylwzbtd")
                                        .withTier(SkuTier.BASIC)
                                        .withSize("znbmpowuwprzq")
                                        .withFamily("eualupjmkhf")
                                        .withCapacity(768618296))
                                .withStorageAccountName("qhakauhashsf")))
                .withNextLink("vxqtayriwwroyqbe");
        model = BinaryData.fromObject(model).toObject(RemoteRenderingAccountPage.class);
        Assertions.assertEquals("sucocmnyyazttbtw", model.value().get(0).location());
        Assertions.assertEquals("puedckzywbiexzf", model.value().get(0).tags().get("yueaxibxujwb"));
        Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type());
        Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).plan().type());
        Assertions.assertEquals("pnazzm", model.value().get(0).sku().name());
        Assertions.assertEquals(SkuTier.BASIC, model.value().get(0).sku().tier());
        Assertions.assertEquals("nmpxttdb", model.value().get(0).sku().size());
        Assertions.assertEquals("bnlankxmyskpb", model.value().get(0).sku().family());
        Assertions.assertEquals(1074926668, model.value().get(0).sku().capacity());
        Assertions.assertEquals("tkcxywnytnrsy", model.value().get(0).kind().name());
        Assertions.assertEquals(SkuTier.BASIC, model.value().get(0).kind().tier());
        Assertions.assertEquals("dybyxczfclhaa", model.value().get(0).kind().size());
        Assertions.assertEquals("babphlwrqlfk", model.value().get(0).kind().family());
        Assertions.assertEquals(1003967781, model.value().get(0).kind().capacity());
        Assertions.assertEquals("debfqkkrbmpukgri", model.value().get(0).storageAccountName());
        Assertions.assertEquals("vxqtayriwwroyqbe", model.nextLink());
    }

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