// 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;

public final class ElasticSanPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ElasticSanProperties model =
            BinaryData
                .fromString(
                    "{\"sku\":{\"name\":\"Premium_LRS\",\"tier\":\"Premium\"},\"availabilityZones\":[\"aajrm\",\"djwzrlov\",\"clwhijcoejctbz\",\"qsqsy\"],\"provisioningState\":\"Failed\",\"baseSizeTiB\":2042468041956868674,\"extendedCapacitySizeTiB\":922454223620020137,\"totalVolumeSizeGiB\":6954441473774697621,\"volumeGroupCount\":7905979691977489381,\"totalIops\":7972922778163490727,\"totalMBps\":3960203806561274270,\"totalSizeTiB\":8067111908299407616,\"privateEndpointConnections\":[{\"properties\":{\"provisioningState\":\"Invalid\",\"privateEndpoint\":{\"id\":\"dtocj\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"pmouexhdz\",\"actionsRequired\":\"bqe\"},\"groupIds\":[\"xqbzvddntwnd\",\"icbtwnpzao\",\"vuhrhcffcyddgl\"]},\"id\":\"t\",\"name\":\"jqkwpyeicx\",\"type\":\"qciwqvhkhixuigdt\"},{\"properties\":{\"provisioningState\":\"Succeeded\",\"privateEndpoint\":{\"id\":\"joghmewuama\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"ayvvtpgvdf\",\"actionsRequired\":\"otkftutqxlngx\"},\"groupIds\":[\"gug\",\"xkrxdqmi\",\"tthzrvqd\",\"abhjybi\"]},\"id\":\"h\",\"name\":\"qfbow\",\"type\":\"kanyktzlcuiywg\"},{\"properties\":{\"provisioningState\":\"Updating\",\"privateEndpoint\":{\"id\":\"drvyn\"},\"privateLinkServiceConnectionState\":{\"status\":\"Failed\",\"description\":\"phrcgyncoc\",\"actionsRequired\":\"cfvmmco\"},\"groupIds\":[\"xlzevgbmqjqabcy\",\"mivkwlzuvcc\",\"wnfnbacf\"]},\"id\":\"nlebxetqgtzxd\",\"name\":\"nqbqqwxr\",\"type\":\"feallnwsu\"},{\"properties\":{\"provisioningState\":\"Pending\",\"privateEndpoint\":{\"id\":\"ampmngnz\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"qwoochcbon\",\"actionsRequired\":\"pkvlrxn\"},\"groupIds\":[\"seiphe\"]},\"id\":\"lokeyy\",\"name\":\"enjbdlwtgrhp\",\"type\":\"jp\"}]}")
                .toObject(ElasticSanProperties.class);
        Assertions.assertEquals(SkuName.PREMIUM_LRS, model.sku().name());
        Assertions.assertEquals(SkuTier.PREMIUM, model.sku().tier());
        Assertions.assertEquals("aajrm", model.availabilityZones().get(0));
        Assertions.assertEquals(2042468041956868674L, model.baseSizeTiB());
        Assertions.assertEquals(922454223620020137L, model.extendedCapacitySizeTiB());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ElasticSanProperties model =
            new ElasticSanProperties()
                .withSku(new Sku().withName(SkuName.PREMIUM_LRS).withTier(SkuTier.PREMIUM))
                .withAvailabilityZones(Arrays.asList("aajrm", "djwzrlov", "clwhijcoejctbz", "qsqsy"))
                .withBaseSizeTiB(2042468041956868674L)
                .withExtendedCapacitySizeTiB(922454223620020137L);
        model = BinaryData.fromObject(model).toObject(ElasticSanProperties.class);
        Assertions.assertEquals(SkuName.PREMIUM_LRS, model.sku().name());
        Assertions.assertEquals(SkuTier.PREMIUM, model.sku().tier());
        Assertions.assertEquals("aajrm", model.availabilityZones().get(0));
        Assertions.assertEquals(2042468041956868674L, model.baseSizeTiB());
        Assertions.assertEquals(922454223620020137L, model.extendedCapacitySizeTiB());
    }
}
