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

package com.azure.resourcemanager.recoveryservicesbackup.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.recoveryservicesbackup.models.AzureFileShareRestoreRequest;
import com.azure.resourcemanager.recoveryservicesbackup.models.CopyOptions;
import com.azure.resourcemanager.recoveryservicesbackup.models.RecoveryType;
import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreFileSpecs;
import com.azure.resourcemanager.recoveryservicesbackup.models.RestoreRequestType;
import com.azure.resourcemanager.recoveryservicesbackup.models.TargetAfsRestoreInfo;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AzureFileShareRestoreRequestTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureFileShareRestoreRequest model =
            BinaryData
                .fromString(
                    "{\"objectType\":\"AzureFileShareRestoreRequest\",\"recoveryType\":\"AlternateLocation\",\"sourceResourceId\":\"znxcvds\",\"copyOptions\":\"Skip\",\"restoreRequestType\":\"ItemLevelRestore\",\"restoreFileSpecs\":[{\"path\":\"v\",\"fileSpecType\":\"ovqfzge\",\"targetFolderPath\":\"dftuljltduce\"},{\"path\":\"tmczuomejwcwwqi\",\"fileSpecType\":\"nssxmojmsvpk\",\"targetFolderPath\":\"rvkwc\"},{\"path\":\"ql\",\"fileSpecType\":\"x\",\"targetFolderPath\":\"czheyd\"}],\"targetDetails\":{\"name\":\"shmkxmaehvbbxur\",\"targetResourceId\":\"ltfnhtbaxkgx\"}}")
                .toObject(AzureFileShareRestoreRequest.class);
        Assertions.assertEquals(RecoveryType.ALTERNATE_LOCATION, model.recoveryType());
        Assertions.assertEquals("znxcvds", model.sourceResourceId());
        Assertions.assertEquals(CopyOptions.SKIP, model.copyOptions());
        Assertions.assertEquals(RestoreRequestType.ITEM_LEVEL_RESTORE, model.restoreRequestType());
        Assertions.assertEquals("v", model.restoreFileSpecs().get(0).path());
        Assertions.assertEquals("ovqfzge", model.restoreFileSpecs().get(0).fileSpecType());
        Assertions.assertEquals("dftuljltduce", model.restoreFileSpecs().get(0).targetFolderPath());
        Assertions.assertEquals("shmkxmaehvbbxur", model.targetDetails().name());
        Assertions.assertEquals("ltfnhtbaxkgx", model.targetDetails().targetResourceId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureFileShareRestoreRequest model =
            new AzureFileShareRestoreRequest()
                .withRecoveryType(RecoveryType.ALTERNATE_LOCATION)
                .withSourceResourceId("znxcvds")
                .withCopyOptions(CopyOptions.SKIP)
                .withRestoreRequestType(RestoreRequestType.ITEM_LEVEL_RESTORE)
                .withRestoreFileSpecs(
                    Arrays
                        .asList(
                            new RestoreFileSpecs()
                                .withPath("v")
                                .withFileSpecType("ovqfzge")
                                .withTargetFolderPath("dftuljltduce"),
                            new RestoreFileSpecs()
                                .withPath("tmczuomejwcwwqi")
                                .withFileSpecType("nssxmojmsvpk")
                                .withTargetFolderPath("rvkwc"),
                            new RestoreFileSpecs().withPath("ql").withFileSpecType("x").withTargetFolderPath("czheyd")))
                .withTargetDetails(
                    new TargetAfsRestoreInfo().withName("shmkxmaehvbbxur").withTargetResourceId("ltfnhtbaxkgx"));
        model = BinaryData.fromObject(model).toObject(AzureFileShareRestoreRequest.class);
        Assertions.assertEquals(RecoveryType.ALTERNATE_LOCATION, model.recoveryType());
        Assertions.assertEquals("znxcvds", model.sourceResourceId());
        Assertions.assertEquals(CopyOptions.SKIP, model.copyOptions());
        Assertions.assertEquals(RestoreRequestType.ITEM_LEVEL_RESTORE, model.restoreRequestType());
        Assertions.assertEquals("v", model.restoreFileSpecs().get(0).path());
        Assertions.assertEquals("ovqfzge", model.restoreFileSpecs().get(0).fileSpecType());
        Assertions.assertEquals("dftuljltduce", model.restoreFileSpecs().get(0).targetFolderPath());
        Assertions.assertEquals("shmkxmaehvbbxur", model.targetDetails().name());
        Assertions.assertEquals("ltfnhtbaxkgx", model.targetDetails().targetResourceId());
    }
}
