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

package com.azure.resourcemanager.elasticsan.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.elasticsan.fluent.models.ElasticSanProperties;
import com.azure.resourcemanager.elasticsan.models.Sku;
import com.azure.resourcemanager.elasticsan.models.SkuName;
import com.azure.resourcemanager.elasticsan.models.SkuTier;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class ElasticSanPropertiesTests {
    @Test
    public void testDeserialize() {
        ElasticSanProperties model =
            BinaryData
                .fromString(
                    "{\"sku\":{\"name\":\"Premium_LRS\",\"tier\":\"Premium\"},\"availabilityZones\":[\"qfou\",\"lmmnkzsmodmglo\",\"gpbkwtmut\"],\"provisioningState\":\"Updating\",\"baseSizeTiB\":6527154524069647921,\"extendedCapacitySizeTiB\":1771403867569508229,\"totalVolumeSizeGiB\":52315490134475287,\"volumeGroupCount\":6844497267979767976,\"totalIops\":1162811232812995218,\"totalMBps\":3925308584978476249,\"totalSizeTiB\":438414223496146257}")
                .toObject(ElasticSanProperties.class);
        Assertions.assertEquals(SkuName.PREMIUM_LRS, model.sku().name());
        Assertions.assertEquals(SkuTier.PREMIUM, model.sku().tier());
        Assertions.assertEquals("qfou", model.availabilityZones().get(0));
        Assertions.assertEquals(6527154524069647921L, model.baseSizeTiB());
        Assertions.assertEquals(1771403867569508229L, model.extendedCapacitySizeTiB());
    }

    @Test
    public void testSerialize() {
        ElasticSanProperties model =
            new ElasticSanProperties()
                .withSku(new Sku().withName(SkuName.PREMIUM_LRS).withTier(SkuTier.PREMIUM))
                .withAvailabilityZones(Arrays.asList("qfou", "lmmnkzsmodmglo", "gpbkwtmut"))
                .withBaseSizeTiB(6527154524069647921L)
                .withExtendedCapacitySizeTiB(1771403867569508229L);
        model = BinaryData.fromObject(model).toObject(ElasticSanProperties.class);
        Assertions.assertEquals(SkuName.PREMIUM_LRS, model.sku().name());
        Assertions.assertEquals(SkuTier.PREMIUM, model.sku().tier());
        Assertions.assertEquals("qfou", model.availabilityZones().get(0));
        Assertions.assertEquals(6527154524069647921L, model.baseSizeTiB());
        Assertions.assertEquals(1771403867569508229L, model.extendedCapacitySizeTiB());
    }
}
