// 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.models.CostDetailsMetricType;
import com.azure.resourcemanager.costmanagement.models.CostDetailsTimePeriod;
import com.azure.resourcemanager.costmanagement.models.GenerateCostDetailsReportRequestDefinition;
import org.junit.jupiter.api.Assertions;

public final class GenerateCostDetailsReportRequestDefinitionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        GenerateCostDetailsReportRequestDefinition model =
            BinaryData
                .fromString(
                    "{\"metric\":\"AmortizedCost\",\"timePeriod\":{\"start\":\"bminrfdwoyuhhzi\",\"end\":\"iefozbhdmsml\"},\"billingPeriod\":\"qhoftrmaequiah\",\"invoiceId\":\"cslfaoqzpiyylha\"}")
                .toObject(GenerateCostDetailsReportRequestDefinition.class);
        Assertions.assertEquals(CostDetailsMetricType.AMORTIZED_COST, model.metric());
        Assertions.assertEquals("bminrfdwoyuhhzi", model.timePeriod().start());
        Assertions.assertEquals("iefozbhdmsml", model.timePeriod().end());
        Assertions.assertEquals("qhoftrmaequiah", model.billingPeriod());
        Assertions.assertEquals("cslfaoqzpiyylha", model.invoiceId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        GenerateCostDetailsReportRequestDefinition model =
            new GenerateCostDetailsReportRequestDefinition()
                .withMetric(CostDetailsMetricType.AMORTIZED_COST)
                .withTimePeriod(new CostDetailsTimePeriod().withStart("bminrfdwoyuhhzi").withEnd("iefozbhdmsml"))
                .withBillingPeriod("qhoftrmaequiah")
                .withInvoiceId("cslfaoqzpiyylha");
        model = BinaryData.fromObject(model).toObject(GenerateCostDetailsReportRequestDefinition.class);
        Assertions.assertEquals(CostDetailsMetricType.AMORTIZED_COST, model.metric());
        Assertions.assertEquals("bminrfdwoyuhhzi", model.timePeriod().start());
        Assertions.assertEquals("iefozbhdmsml", model.timePeriod().end());
        Assertions.assertEquals("qhoftrmaequiah", model.billingPeriod());
        Assertions.assertEquals("cslfaoqzpiyylha", model.invoiceId());
    }
}
