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

package com.azure.resourcemanager.logic.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.logic.fluent.models.IntegrationServiceEnvironmentSkuDefinitionInner;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentSkuCapacity;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentSkuDefinitionSku;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentSkuName;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentSkuScaleType;
import org.junit.jupiter.api.Assertions;

public final class IntegrationServiceEnvironmentSkuDefinitionInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        IntegrationServiceEnvironmentSkuDefinitionInner model =
            BinaryData
                .fromString(
                    "{\"resourceType\":\"oyxprimr\",\"sku\":{\"name\":\"Developer\",\"tier\":\"ecj\"},\"capacity\":{\"minimum\":1909529560,\"maximum\":1625342003,\"default\":749085962,\"scaleType\":\"Manual\"}}")
                .toObject(IntegrationServiceEnvironmentSkuDefinitionInner.class);
        Assertions.assertEquals("oyxprimr", model.resourceType());
        Assertions.assertEquals(IntegrationServiceEnvironmentSkuName.DEVELOPER, model.sku().name());
        Assertions.assertEquals("ecj", model.sku().tier());
        Assertions.assertEquals(1909529560, model.capacity().minimum());
        Assertions.assertEquals(1625342003, model.capacity().maximum());
        Assertions.assertEquals(749085962, model.capacity().defaultProperty());
        Assertions.assertEquals(IntegrationServiceEnvironmentSkuScaleType.MANUAL, model.capacity().scaleType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        IntegrationServiceEnvironmentSkuDefinitionInner model =
            new IntegrationServiceEnvironmentSkuDefinitionInner()
                .withResourceType("oyxprimr")
                .withSku(
                    new IntegrationServiceEnvironmentSkuDefinitionSku()
                        .withName(IntegrationServiceEnvironmentSkuName.DEVELOPER)
                        .withTier("ecj"))
                .withCapacity(
                    new IntegrationServiceEnvironmentSkuCapacity()
                        .withMinimum(1909529560)
                        .withMaximum(1625342003)
                        .withDefaultProperty(749085962)
                        .withScaleType(IntegrationServiceEnvironmentSkuScaleType.MANUAL));
        model = BinaryData.fromObject(model).toObject(IntegrationServiceEnvironmentSkuDefinitionInner.class);
        Assertions.assertEquals("oyxprimr", model.resourceType());
        Assertions.assertEquals(IntegrationServiceEnvironmentSkuName.DEVELOPER, model.sku().name());
        Assertions.assertEquals("ecj", model.sku().tier());
        Assertions.assertEquals(1909529560, model.capacity().minimum());
        Assertions.assertEquals(1625342003, model.capacity().maximum());
        Assertions.assertEquals(749085962, model.capacity().defaultProperty());
        Assertions.assertEquals(IntegrationServiceEnvironmentSkuScaleType.MANUAL, model.capacity().scaleType());
    }
}
