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

package com.azure.resourcemanager.synapse.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.synapse.fluent.models.AzureResourceSkuInner;
import com.azure.resourcemanager.synapse.models.AzureCapacity;
import com.azure.resourcemanager.synapse.models.AzureScaleType;
import com.azure.resourcemanager.synapse.models.AzureSku;
import com.azure.resourcemanager.synapse.models.SkuName;
import com.azure.resourcemanager.synapse.models.SkuSize;
import org.junit.jupiter.api.Assertions;

public final class AzureResourceSkuInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureResourceSkuInner model =
            BinaryData
                .fromString(
                    "{\"resourceType\":\"pcmsplbyrrueqth\",\"sku\":{\"name\":\"Storage"
                        + " optimized\",\"capacity\":1745918799,\"size\":\"Extra"
                        + " small\"},\"capacity\":{\"scaleType\":\"none\",\"minimum\":1035435705,\"maximum\":806995622,\"default\":1214736566}}")
                .toObject(AzureResourceSkuInner.class);
        Assertions.assertEquals("pcmsplbyrrueqth", model.resourceType());
        Assertions.assertEquals(SkuName.STORAGE_OPTIMIZED, model.sku().name());
        Assertions.assertEquals(1745918799, model.sku().capacity());
        Assertions.assertEquals(SkuSize.EXTRA_SMALL, model.sku().size());
        Assertions.assertEquals(AzureScaleType.NONE, model.capacity().scaleType());
        Assertions.assertEquals(1035435705, model.capacity().minimum());
        Assertions.assertEquals(806995622, model.capacity().maximum());
        Assertions.assertEquals(1214736566, model.capacity().defaultProperty());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureResourceSkuInner model =
            new AzureResourceSkuInner()
                .withResourceType("pcmsplbyrrueqth")
                .withSku(
                    new AzureSku()
                        .withName(SkuName.STORAGE_OPTIMIZED)
                        .withCapacity(1745918799)
                        .withSize(SkuSize.EXTRA_SMALL))
                .withCapacity(
                    new AzureCapacity()
                        .withScaleType(AzureScaleType.NONE)
                        .withMinimum(1035435705)
                        .withMaximum(806995622)
                        .withDefaultProperty(1214736566));
        model = BinaryData.fromObject(model).toObject(AzureResourceSkuInner.class);
        Assertions.assertEquals("pcmsplbyrrueqth", model.resourceType());
        Assertions.assertEquals(SkuName.STORAGE_OPTIMIZED, model.sku().name());
        Assertions.assertEquals(1745918799, model.sku().capacity());
        Assertions.assertEquals(SkuSize.EXTRA_SMALL, model.sku().size());
        Assertions.assertEquals(AzureScaleType.NONE, model.capacity().scaleType());
        Assertions.assertEquals(1035435705, model.capacity().minimum());
        Assertions.assertEquals(806995622, model.capacity().maximum());
        Assertions.assertEquals(1214736566, model.capacity().defaultProperty());
    }
}
