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

package com.azure.resourcemanager.costmanagement.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.costmanagement.fluent.models.ReportManifest;
import com.azure.resourcemanager.costmanagement.models.BlobInfo;
import com.azure.resourcemanager.costmanagement.models.CostDetailsDataFormat;
import com.azure.resourcemanager.costmanagement.models.CostDetailsMetricType;
import com.azure.resourcemanager.costmanagement.models.GenerateCostDetailsReportRequestDefinition;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class ReportManifestTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ReportManifest model =
            BinaryData
                .fromString(
                    "{\"manifestVersion\":\"gq\",\"dataFormat\":\"Csv\",\"byteCount\":8734080438498794448,\"blobCount\":600272259,\"compressData\":false,\"requestContext\":{\"requestScope\":\"fpel\",\"requestBody\":{\"metric\":\"ActualCost\",\"billingPeriod\":\"srp\",\"invoiceId\":\"ujzra\"}},\"blobs\":[{\"blobLink\":\"dw\",\"byteCount\":6706633430332800015}]}")
                .toObject(ReportManifest.class);
        Assertions.assertEquals("gq", model.manifestVersion());
        Assertions.assertEquals(CostDetailsDataFormat.CSV, model.dataFormat());
        Assertions.assertEquals(8734080438498794448L, model.byteCount());
        Assertions.assertEquals(600272259, model.blobCount());
        Assertions.assertEquals(false, model.compressData());
        Assertions.assertEquals("dw", model.blobs().get(0).blobLink());
        Assertions.assertEquals(6706633430332800015L, model.blobs().get(0).byteCount());
        Assertions.assertEquals("fpel", model.requestScope());
        Assertions.assertEquals(CostDetailsMetricType.ACTUAL_COST, model.requestBody().metric());
        Assertions.assertEquals("srp", model.requestBody().billingPeriod());
        Assertions.assertEquals("ujzra", model.requestBody().invoiceId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ReportManifest model =
            new ReportManifest()
                .withManifestVersion("gq")
                .withDataFormat(CostDetailsDataFormat.CSV)
                .withByteCount(8734080438498794448L)
                .withBlobCount(600272259)
                .withCompressData(false)
                .withBlobs(Arrays.asList(new BlobInfo().withBlobLink("dw").withByteCount(6706633430332800015L)))
                .withRequestScope("fpel")
                .withRequestBody(
                    new GenerateCostDetailsReportRequestDefinition()
                        .withMetric(CostDetailsMetricType.ACTUAL_COST)
                        .withBillingPeriod("srp")
                        .withInvoiceId("ujzra"));
        model = BinaryData.fromObject(model).toObject(ReportManifest.class);
        Assertions.assertEquals("gq", model.manifestVersion());
        Assertions.assertEquals(CostDetailsDataFormat.CSV, model.dataFormat());
        Assertions.assertEquals(8734080438498794448L, model.byteCount());
        Assertions.assertEquals(600272259, model.blobCount());
        Assertions.assertEquals(false, model.compressData());
        Assertions.assertEquals("dw", model.blobs().get(0).blobLink());
        Assertions.assertEquals(6706633430332800015L, model.blobs().get(0).byteCount());
        Assertions.assertEquals("fpel", model.requestScope());
        Assertions.assertEquals(CostDetailsMetricType.ACTUAL_COST, model.requestBody().metric());
        Assertions.assertEquals("srp", model.requestBody().billingPeriod());
        Assertions.assertEquals("ujzra", model.requestBody().invoiceId());
    }
}
