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

package com.azure.resourcemanager.cognitiveservices.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.cognitiveservices.fluent.models.CommitmentTierInner;
import com.azure.resourcemanager.cognitiveservices.models.CommitmentCost;
import com.azure.resourcemanager.cognitiveservices.models.CommitmentQuota;
import com.azure.resourcemanager.cognitiveservices.models.HostingModel;
import org.junit.jupiter.api.Assertions;

public final class CommitmentTierInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        CommitmentTierInner model =
            BinaryData
                .fromString(
                    "{\"kind\":\"c\",\"skuName\":\"ynqwwncwzzhxgk\",\"hostingModel\":\"ConnectedContainer\",\"planType\":\"ucnapkteoellwp\",\"tier\":\"d\",\"maxCount\":1046571541,\"quota\":{\"quantity\":816546176101077379,\"unit\":\"ceopzfqrhhuaopp\"},\"cost\":{\"commitmentMeterId\":\"eqx\",\"overageMeterId\":\"z\"}}")
                .toObject(CommitmentTierInner.class);
        Assertions.assertEquals("c", model.kind());
        Assertions.assertEquals("ynqwwncwzzhxgk", model.skuName());
        Assertions.assertEquals(HostingModel.CONNECTED_CONTAINER, model.hostingModel());
        Assertions.assertEquals("ucnapkteoellwp", model.planType());
        Assertions.assertEquals("d", model.tier());
        Assertions.assertEquals(1046571541, model.maxCount());
        Assertions.assertEquals(816546176101077379L, model.quota().quantity());
        Assertions.assertEquals("ceopzfqrhhuaopp", model.quota().unit());
        Assertions.assertEquals("eqx", model.cost().commitmentMeterId());
        Assertions.assertEquals("z", model.cost().overageMeterId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        CommitmentTierInner model =
            new CommitmentTierInner()
                .withKind("c")
                .withSkuName("ynqwwncwzzhxgk")
                .withHostingModel(HostingModel.CONNECTED_CONTAINER)
                .withPlanType("ucnapkteoellwp")
                .withTier("d")
                .withMaxCount(1046571541)
                .withQuota(new CommitmentQuota().withQuantity(816546176101077379L).withUnit("ceopzfqrhhuaopp"))
                .withCost(new CommitmentCost().withCommitmentMeterId("eqx").withOverageMeterId("z"));
        model = BinaryData.fromObject(model).toObject(CommitmentTierInner.class);
        Assertions.assertEquals("c", model.kind());
        Assertions.assertEquals("ynqwwncwzzhxgk", model.skuName());
        Assertions.assertEquals(HostingModel.CONNECTED_CONTAINER, model.hostingModel());
        Assertions.assertEquals("ucnapkteoellwp", model.planType());
        Assertions.assertEquals("d", model.tier());
        Assertions.assertEquals(1046571541, model.maxCount());
        Assertions.assertEquals(816546176101077379L, model.quota().quantity());
        Assertions.assertEquals("ceopzfqrhhuaopp", model.quota().unit());
        Assertions.assertEquals("eqx", model.cost().commitmentMeterId());
        Assertions.assertEquals("z", model.cost().overageMeterId());
    }
}
