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

package com.azure.resourcemanager.billing.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.billing.fluent.models.TransactionInner;
import com.azure.resourcemanager.billing.models.ReservationType;
import com.azure.resourcemanager.billing.models.TransactionTypeKind;
import org.junit.jupiter.api.Assertions;

public final class TransactionInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        TransactionInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"kind\":\"reservation\",\"date\":\"2021-02-11T03:05:15Z\",\"invoice\":\"vfgbvfvpdboda\",\"invoiceId\":\"zsjqlh\",\"orderId\":\"r\",\"orderName\":\"deibqip\",\"productFamily\":\"ghvxndzwmkrefa\",\"productTypeId\":\"jorwkqnyhgbij\",\"productType\":\"ivfxzsjabibsyst\",\"productDescription\":\"fsdjpvkvp\",\"transactionType\":\"Usage"
                        + " Charge\",\"transactionAmount\":{\"currency\":\"zbzkdvncjabudurg\",\"value\":26.81675},\"quantity\":133724472,\"invoiceSectionId\":\"zhjjklffhmouwq\",\"invoiceSectionDisplayName\":\"zrfze\",\"billingProfileId\":\"ebizikayuh\",\"billingProfileDisplayName\":\"bjbsybb\",\"customerId\":\"r\",\"customerDisplayName\":\"ldgmfpgvmpip\",\"subscriptionId\":\"ltha\",\"subscriptionName\":\"x\",\"azurePlan\":\"mwutwbdsre\",\"azureCreditApplied\":{\"currency\":\"rhneuyowq\",\"value\":14.874917},\"billingCurrency\":\"t\",\"discount\":8.667755,\"effectivePrice\":{\"currency\":\"rcgp\",\"value\":82.618744},\"exchangeRate\":48.570366,\"marketPrice\":{\"currency\":\"j\",\"value\":71.50711},\"pricingCurrency\":\"fzxiavrmb\",\"servicePeriodStartDate\":\"2021-09-13T10:29:44Z\",\"servicePeriodEndDate\":\"2021-09-04T02:46:50Z\",\"subTotal\":{\"currency\":\"rjqc\",\"value\":39.849525},\"tax\":{\"currency\":\"frl\",\"value\":33.48236},\"unitOfMeasure\":\"rnwoiindfp\",\"units\":71.931244,\"unitType\":\"lwbtlhf\"},\"id\":\"sj\",\"name\":\"dhszfjv\",\"type\":\"bgofeljag\"}")
                .toObject(TransactionInner.class);
        Assertions.assertEquals(TransactionTypeKind.RESERVATION, model.kind());
        Assertions.assertEquals(ReservationType.USAGE_CHARGE, model.transactionType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        TransactionInner model =
            new TransactionInner()
                .withKind(TransactionTypeKind.RESERVATION)
                .withTransactionType(ReservationType.USAGE_CHARGE);
        model = BinaryData.fromObject(model).toObject(TransactionInner.class);
        Assertions.assertEquals(TransactionTypeKind.RESERVATION, model.kind());
        Assertions.assertEquals(ReservationType.USAGE_CHARGE, model.transactionType());
    }
}
