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

package com.azure.resourcemanager.maintenance.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.maintenance.fluent.models.UpdateInner;
import com.azure.resourcemanager.maintenance.models.ImpactType;
import com.azure.resourcemanager.maintenance.models.MaintenanceScope;
import com.azure.resourcemanager.maintenance.models.UpdateStatus;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class UpdateInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        UpdateInner model =
            BinaryData
                .fromString(
                    "{\"maintenanceScope\":\"Resource\",\"impactType\":\"None\",\"status\":\"Pending\",\"impactDurationInSec\":1267034334,\"notBefore\":\"2021-09-05T17:35:53Z\",\"properties\":{\"resourceId\":\"ow\"}}")
                .toObject(UpdateInner.class);
        Assertions.assertEquals(MaintenanceScope.RESOURCE, model.maintenanceScope());
        Assertions.assertEquals(ImpactType.NONE, model.impactType());
        Assertions.assertEquals(UpdateStatus.PENDING, model.status());
        Assertions.assertEquals(1267034334, model.impactDurationInSec());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-05T17:35:53Z"), model.notBefore());
        Assertions.assertEquals("ow", model.resourceId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        UpdateInner model =
            new UpdateInner()
                .withMaintenanceScope(MaintenanceScope.RESOURCE)
                .withImpactType(ImpactType.NONE)
                .withStatus(UpdateStatus.PENDING)
                .withImpactDurationInSec(1267034334)
                .withNotBefore(OffsetDateTime.parse("2021-09-05T17:35:53Z"))
                .withResourceId("ow");
        model = BinaryData.fromObject(model).toObject(UpdateInner.class);
        Assertions.assertEquals(MaintenanceScope.RESOURCE, model.maintenanceScope());
        Assertions.assertEquals(ImpactType.NONE, model.impactType());
        Assertions.assertEquals(UpdateStatus.PENDING, model.status());
        Assertions.assertEquals(1267034334, model.impactDurationInSec());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-05T17:35:53Z"), model.notBefore());
        Assertions.assertEquals("ow", model.resourceId());
    }
}
