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

package com.azure.resourcemanager.resourcemover.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.resourcemover.models.AutomaticResolutionProperties;
import com.azure.resourcemanager.resourcemover.models.DependencyType;
import com.azure.resourcemanager.resourcemover.models.ManualResolutionProperties;
import com.azure.resourcemanager.resourcemover.models.MoveResourceDependency;
import com.azure.resourcemanager.resourcemover.models.ResolutionType;
import org.junit.jupiter.api.Assertions;

public final class MoveResourceDependencyTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        MoveResourceDependency model =
            BinaryData
                .fromString(
                    "{\"id\":\"erhhbcsglumm\",\"resolutionStatus\":\"tjaodxobnb\",\"resolutionType\":\"Manual\",\"dependencyType\":\"RequiredForMove\",\"manualResolution\":{\"targetId\":\"kajionpim\"},\"automaticResolution\":{\"moveResourceId\":\"stxgc\"},\"isOptional\":\"dg\"}")
                .toObject(MoveResourceDependency.class);
        Assertions.assertEquals("erhhbcsglumm", model.id());
        Assertions.assertEquals("tjaodxobnb", model.resolutionStatus());
        Assertions.assertEquals(ResolutionType.MANUAL, model.resolutionType());
        Assertions.assertEquals(DependencyType.REQUIRED_FOR_MOVE, model.dependencyType());
        Assertions.assertEquals("kajionpim", model.manualResolution().targetId());
        Assertions.assertEquals("stxgc", model.automaticResolution().moveResourceId());
        Assertions.assertEquals("dg", model.isOptional());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        MoveResourceDependency model =
            new MoveResourceDependency()
                .withId("erhhbcsglumm")
                .withResolutionStatus("tjaodxobnb")
                .withResolutionType(ResolutionType.MANUAL)
                .withDependencyType(DependencyType.REQUIRED_FOR_MOVE)
                .withManualResolution(new ManualResolutionProperties().withTargetId("kajionpim"))
                .withAutomaticResolution(new AutomaticResolutionProperties().withMoveResourceId("stxgc"))
                .withIsOptional("dg");
        model = BinaryData.fromObject(model).toObject(MoveResourceDependency.class);
        Assertions.assertEquals("erhhbcsglumm", model.id());
        Assertions.assertEquals("tjaodxobnb", model.resolutionStatus());
        Assertions.assertEquals(ResolutionType.MANUAL, model.resolutionType());
        Assertions.assertEquals(DependencyType.REQUIRED_FOR_MOVE, model.dependencyType());
        Assertions.assertEquals("kajionpim", model.manualResolution().targetId());
        Assertions.assertEquals("stxgc", model.automaticResolution().moveResourceId());
        Assertions.assertEquals("dg", model.isOptional());
    }
}
