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

package com.azure.resourcemanager.kusto.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.kusto.fluent.models.AzureResourceSkuInner;
import com.azure.resourcemanager.kusto.models.AzureCapacity;
import com.azure.resourcemanager.kusto.models.AzureScaleType;
import com.azure.resourcemanager.kusto.models.AzureSku;
import com.azure.resourcemanager.kusto.models.AzureSkuName;
import com.azure.resourcemanager.kusto.models.AzureSkuTier;
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\":\"ux\",\"sku\":{\"name\":\"Standard_D11_v2\",\"capacity\":1400002261,\"tier\":\"Standard\"},\"capacity\":{\"scaleType\":\"none\",\"minimum\":1605187994,\"maximum\":1767161087,\"default\":1552769506}}")
                .toObject(AzureResourceSkuInner.class);
        Assertions.assertEquals("ux", model.resourceType());
        Assertions.assertEquals(AzureSkuName.STANDARD_D11_V2, model.sku().name());
        Assertions.assertEquals(1400002261, model.sku().capacity());
        Assertions.assertEquals(AzureSkuTier.STANDARD, model.sku().tier());
        Assertions.assertEquals(AzureScaleType.NONE, model.capacity().scaleType());
        Assertions.assertEquals(1605187994, model.capacity().minimum());
        Assertions.assertEquals(1767161087, model.capacity().maximum());
        Assertions.assertEquals(1552769506, model.capacity().defaultProperty());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureResourceSkuInner model =
            new AzureResourceSkuInner()
                .withResourceType("ux")
                .withSku(
                    new AzureSku()
                        .withName(AzureSkuName.STANDARD_D11_V2)
                        .withCapacity(1400002261)
                        .withTier(AzureSkuTier.STANDARD))
                .withCapacity(
                    new AzureCapacity()
                        .withScaleType(AzureScaleType.NONE)
                        .withMinimum(1605187994)
                        .withMaximum(1767161087)
                        .withDefaultProperty(1552769506));
        model = BinaryData.fromObject(model).toObject(AzureResourceSkuInner.class);
        Assertions.assertEquals("ux", model.resourceType());
        Assertions.assertEquals(AzureSkuName.STANDARD_D11_V2, model.sku().name());
        Assertions.assertEquals(1400002261, model.sku().capacity());
        Assertions.assertEquals(AzureSkuTier.STANDARD, model.sku().tier());
        Assertions.assertEquals(AzureScaleType.NONE, model.capacity().scaleType());
        Assertions.assertEquals(1605187994, model.capacity().minimum());
        Assertions.assertEquals(1767161087, model.capacity().maximum());
        Assertions.assertEquals(1552769506, model.capacity().defaultProperty());
    }
}
