// 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.TransactionProperties;
import com.azure.resourcemanager.billing.models.ReservationType;
import com.azure.resourcemanager.billing.models.TransactionTypeKind;
import org.junit.jupiter.api.Assertions;

public final class TransactionPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        TransactionProperties model =
            BinaryData
                .fromString(
                    "{\"kind\":\"reservation\",\"date\":\"2021-11-19T13:43:04Z\",\"invoice\":\"dvriiiojnal\",\"invoiceId\":\"fk\",\"orderId\":\"vsexsowuelu\",\"orderName\":\"hahhxvrhmzkwpj\",\"productFamily\":\"wspughftqsxhqx\",\"productTypeId\":\"xukndxdigr\",\"productType\":\"uufzdmsyqtfihw\",\"productDescription\":\"otzi\",\"transactionType\":\"Usage"
                        + " Charge\",\"transactionAmount\":{\"currency\":\"pph\",\"value\":41.082405},\"quantity\":1174017685,\"invoiceSectionId\":\"dphqamv\",\"invoiceSectionDisplayName\":\"fwynwcvtbvkay\",\"billingProfileId\":\"tnvyqiatkzwp\",\"billingProfileDisplayName\":\"p\",\"customerId\":\"cjaesgvvs\",\"customerDisplayName\":\"yajguqfhwygzlv\",\"subscriptionId\":\"kfxu\",\"subscriptionName\":\"mdwzrmuhapfcqdps\",\"azurePlan\":\"qvpsvuoymg\",\"azureCreditApplied\":{\"currency\":\"lvez\",\"value\":37.44613},\"billingCurrency\":\"lmfeokerq\",\"discount\":19.447208,\"effectivePrice\":{\"currency\":\"ob\",\"value\":38.23564},\"exchangeRate\":82.422646,\"marketPrice\":{\"currency\":\"owepbqpcrfkb\",\"value\":99.00544},\"pricingCurrency\":\"njv\",\"servicePeriodStartDate\":\"2020-12-20T11:43:27Z\",\"servicePeriodEndDate\":\"2021-06-07T08:17:55Z\",\"subTotal\":{\"currency\":\"ekftnkhtj\",\"value\":1.9628167},\"tax\":{\"currency\":\"wfqatmtd\",\"value\":20.163143},\"unitOfMeasure\":\"vypgikdg\",\"units\":99.876915,\"unitType\":\"kbir\"}")
                .toObject(TransactionProperties.class);
        Assertions.assertEquals(TransactionTypeKind.RESERVATION, model.kind());
        Assertions.assertEquals(ReservationType.USAGE_CHARGE, model.transactionType());
    }

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