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

package com.azure.resourcemanager.dataprotection.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.dataprotection.models.AzureBackupRestoreRequest;
import com.azure.resourcemanager.dataprotection.models.RecoveryOption;
import com.azure.resourcemanager.dataprotection.models.RestoreTargetInfoBase;
import com.azure.resourcemanager.dataprotection.models.SourceDataStoreType;
import com.azure.resourcemanager.dataprotection.models.ValidateRestoreRequestObject;
import org.junit.jupiter.api.Assertions;

public final class ValidateRestoreRequestObjectTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ValidateRestoreRequestObject model =
            BinaryData
                .fromString(
                    "{\"restoreRequestObject\":{\"objectType\":\"AzureBackupRestoreRequest\",\"restoreTargetInfo\":{\"objectType\":\"RestoreTargetInfoBase\",\"recoveryOption\":\"FailIfExists\",\"restoreLocation\":\"kzywbiex\"},\"sourceDataStoreType\":\"ArchiveStore\",\"sourceResourceId\":\"yueaxibxujwb\"}}")
                .toObject(ValidateRestoreRequestObject.class);
        Assertions
            .assertEquals(
                RecoveryOption.FAIL_IF_EXISTS, model.restoreRequestObject().restoreTargetInfo().recoveryOption());
        Assertions.assertEquals("kzywbiex", model.restoreRequestObject().restoreTargetInfo().restoreLocation());
        Assertions.assertEquals(SourceDataStoreType.ARCHIVE_STORE, model.restoreRequestObject().sourceDataStoreType());
        Assertions.assertEquals("yueaxibxujwb", model.restoreRequestObject().sourceResourceId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ValidateRestoreRequestObject model =
            new ValidateRestoreRequestObject()
                .withRestoreRequestObject(
                    new AzureBackupRestoreRequest()
                        .withRestoreTargetInfo(
                            new RestoreTargetInfoBase()
                                .withRecoveryOption(RecoveryOption.FAIL_IF_EXISTS)
                                .withRestoreLocation("kzywbiex"))
                        .withSourceDataStoreType(SourceDataStoreType.ARCHIVE_STORE)
                        .withSourceResourceId("yueaxibxujwb"));
        model = BinaryData.fromObject(model).toObject(ValidateRestoreRequestObject.class);
        Assertions
            .assertEquals(
                RecoveryOption.FAIL_IF_EXISTS, model.restoreRequestObject().restoreTargetInfo().recoveryOption());
        Assertions.assertEquals("kzywbiex", model.restoreRequestObject().restoreTargetInfo().restoreLocation());
        Assertions.assertEquals(SourceDataStoreType.ARCHIVE_STORE, model.restoreRequestObject().sourceDataStoreType());
        Assertions.assertEquals("yueaxibxujwb", model.restoreRequestObject().sourceResourceId());
    }
}
