// 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.GenerateDetailedCostReportOperationStatusesInner;
import com.azure.resourcemanager.costmanagement.models.ReportOperationStatusType;
import com.azure.resourcemanager.costmanagement.models.Status;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class GenerateDetailedCostReportOperationStatusesInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        GenerateDetailedCostReportOperationStatusesInner model =
            BinaryData
                .fromString(
                    "{\"id\":\"ffhmouwqlgzr\",\"name\":\"eeyebi\",\"status\":{\"status\":\"ReadyToDownload\"},\"startTime\":\"uhqlbjbsybbqwrvt\",\"endTime\":\"gmfpgvmp\",\"type\":\"as\",\"properties\":{\"expiryTime\":\"2021-05-09T14:17:26Z\",\"validTill\":\"2021-11-08T17:52:45Z\",\"downloadUrl\":\"smwutwbdsrezpd\"}}")
                .toObject(GenerateDetailedCostReportOperationStatusesInner.class);
        Assertions.assertEquals("ffhmouwqlgzr", model.id());
        Assertions.assertEquals("eeyebi", model.name());
        Assertions.assertEquals(ReportOperationStatusType.READY_TO_DOWNLOAD, model.status().status());
        Assertions.assertEquals("uhqlbjbsybbqwrvt", model.startTime());
        Assertions.assertEquals("gmfpgvmp", model.endTime());
        Assertions.assertEquals("as", model.type());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-08T17:52:45Z"), model.validTill());
        Assertions.assertEquals("smwutwbdsrezpd", model.downloadUrl());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        GenerateDetailedCostReportOperationStatusesInner model =
            new GenerateDetailedCostReportOperationStatusesInner()
                .withId("ffhmouwqlgzr")
                .withName("eeyebi")
                .withStatus(new Status().withStatus(ReportOperationStatusType.READY_TO_DOWNLOAD))
                .withStartTime("uhqlbjbsybbqwrvt")
                .withEndTime("gmfpgvmp")
                .withType("as")
                .withValidTill(OffsetDateTime.parse("2021-11-08T17:52:45Z"))
                .withDownloadUrl("smwutwbdsrezpd");
        model = BinaryData.fromObject(model).toObject(GenerateDetailedCostReportOperationStatusesInner.class);
        Assertions.assertEquals("ffhmouwqlgzr", model.id());
        Assertions.assertEquals("eeyebi", model.name());
        Assertions.assertEquals(ReportOperationStatusType.READY_TO_DOWNLOAD, model.status().status());
        Assertions.assertEquals("uhqlbjbsybbqwrvt", model.startTime());
        Assertions.assertEquals("gmfpgvmp", model.endTime());
        Assertions.assertEquals("as", model.type());
        Assertions.assertEquals(OffsetDateTime.parse("2021-11-08T17:52:45Z"), model.validTill());
        Assertions.assertEquals("smwutwbdsrezpd", model.downloadUrl());
    }
}
