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

package com.azure.resourcemanager.iothub.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.iothub.fluent.models.IotHubSkuDescriptionInner;
import com.azure.resourcemanager.iothub.models.IotHubCapacity;
import com.azure.resourcemanager.iothub.models.IotHubSku;
import com.azure.resourcemanager.iothub.models.IotHubSkuDescriptionListResult;
import com.azure.resourcemanager.iothub.models.IotHubSkuInfo;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class IotHubSkuDescriptionListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IotHubSkuDescriptionListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"resourceType\":\"qugxywpmueefjzwf\",\"sku\":{\"name\":\"B1\",\"tier\":\"Free\",\"capacity\":2752624738826273376},\"capacity\":{\"minimum\":2895240290674738337,\"maximum\":722648832186407891,\"default\":5846205401797666469,\"scaleType\":\"Automatic\"}},{\"resourceType\":\"qxtccmgyudx\",\"sku\":{\"name\":\"B2\",\"tier\":\"Standard\",\"capacity\":5036022727729954665},\"capacity\":{\"minimum\":5697722366346871182,\"maximum\":328428173774055677,\"default\":1705151259952930874,\"scaleType\":\"None\"}},{\"resourceType\":\"hdzhlrqj\",\"sku\":{\"name\":\"B2\",\"tier\":\"Standard\",\"capacity\":6374623406138918990},\"capacity\":{\"minimum\":8781176229641624570,\"maximum\":5275318016138914703,\"default\":1967797899884280622,\"scaleType\":\"None\"}},{\"resourceType\":\"n\",\"sku\":{\"name\":\"S2\",\"tier\":\"Free\",\"capacity\":5373828477618369096},\"capacity\":{\"minimum\":739899630467630797,\"maximum\":574839923891984639,\"default\":6504833090063292182,\"scaleType\":\"Automatic\"}}],\"nextLink\":\"hhseyv\"}")
                .toObject(IotHubSkuDescriptionListResult.class);
        Assertions.assertEquals(IotHubSku.B1, model.value().get(0).sku().name());
        Assertions.assertEquals(2752624738826273376L, model.value().get(0).sku().capacity());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IotHubSkuDescriptionListResult model =
            new IotHubSkuDescriptionListResult()
                .withValue(
                    Arrays
                        .asList(
                            new IotHubSkuDescriptionInner()
                                .withSku(new IotHubSkuInfo().withName(IotHubSku.B1).withCapacity(2752624738826273376L))
                                .withCapacity(new IotHubCapacity()),
                            new IotHubSkuDescriptionInner()
                                .withSku(new IotHubSkuInfo().withName(IotHubSku.B2).withCapacity(5036022727729954665L))
                                .withCapacity(new IotHubCapacity()),
                            new IotHubSkuDescriptionInner()
                                .withSku(new IotHubSkuInfo().withName(IotHubSku.B2).withCapacity(6374623406138918990L))
                                .withCapacity(new IotHubCapacity()),
                            new IotHubSkuDescriptionInner()
                                .withSku(new IotHubSkuInfo().withName(IotHubSku.S2).withCapacity(5373828477618369096L))
                                .withCapacity(new IotHubCapacity())));
        model = BinaryData.fromObject(model).toObject(IotHubSkuDescriptionListResult.class);
        Assertions.assertEquals(IotHubSku.B1, model.value().get(0).sku().name());
        Assertions.assertEquals(2752624738826273376L, model.value().get(0).sku().capacity());
    }
}
