// 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.GenerateDetailedCostReportDefinition;
import com.azure.resourcemanager.costmanagement.models.GenerateDetailedCostReportMetricType;
import com.azure.resourcemanager.costmanagement.models.GenerateDetailedCostReportTimePeriod;
import org.junit.jupiter.api.Assertions;

public final class GenerateDetailedCostReportDefinitionTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        GenerateDetailedCostReportDefinition model =
            BinaryData
                .fromString(
                    "{\"metric\":\"ActualCost\",\"timePeriod\":{\"start\":\"qiby\",\"end\":\"unyowxwl\"},\"billingPeriod\":\"jrkvfgbvfvpdbo\",\"invoiceId\":\"cizsjqlhkrribdei\",\"customerId\":\"ipqkghvxndzwm\"}")
                .toObject(GenerateDetailedCostReportDefinition.class);
        Assertions.assertEquals(GenerateDetailedCostReportMetricType.ACTUAL_COST, model.metric());
        Assertions.assertEquals("qiby", model.timePeriod().start());
        Assertions.assertEquals("unyowxwl", model.timePeriod().end());
        Assertions.assertEquals("jrkvfgbvfvpdbo", model.billingPeriod());
        Assertions.assertEquals("cizsjqlhkrribdei", model.invoiceId());
        Assertions.assertEquals("ipqkghvxndzwm", model.customerId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        GenerateDetailedCostReportDefinition model =
            new GenerateDetailedCostReportDefinition()
                .withMetric(GenerateDetailedCostReportMetricType.ACTUAL_COST)
                .withTimePeriod(new GenerateDetailedCostReportTimePeriod().withStart("qiby").withEnd("unyowxwl"))
                .withBillingPeriod("jrkvfgbvfvpdbo")
                .withInvoiceId("cizsjqlhkrribdei")
                .withCustomerId("ipqkghvxndzwm");
        model = BinaryData.fromObject(model).toObject(GenerateDetailedCostReportDefinition.class);
        Assertions.assertEquals(GenerateDetailedCostReportMetricType.ACTUAL_COST, model.metric());
        Assertions.assertEquals("qiby", model.timePeriod().start());
        Assertions.assertEquals("unyowxwl", model.timePeriod().end());
        Assertions.assertEquals("jrkvfgbvfvpdbo", model.billingPeriod());
        Assertions.assertEquals("cizsjqlhkrribdei", model.invoiceId());
        Assertions.assertEquals("ipqkghvxndzwm", model.customerId());
    }
}
