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

package com.azure.resourcemanager.databox.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.databox.models.DataAccountType;
import com.azure.resourcemanager.databox.models.TransferAllDetails;
import com.azure.resourcemanager.databox.models.TransferConfiguration;
import com.azure.resourcemanager.databox.models.TransferConfigurationTransferAllDetails;
import com.azure.resourcemanager.databox.models.TransferConfigurationTransferFilterDetails;
import com.azure.resourcemanager.databox.models.TransferConfigurationType;
import com.azure.resourcemanager.databox.models.TransferFilterDetails;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class TransferConfigurationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        TransferConfiguration model =
            BinaryData
                .fromString(
                    "{\"transferConfigurationType\":\"TransferUsingFilter\",\"transferFilterDetails\":{\"include\":{\"dataAccountType\":\"StorageAccount\",\"filterFileDetails\":[]}},\"transferAllDetails\":{\"include\":{\"dataAccountType\":\"StorageAccount\",\"transferAllBlobs\":true,\"transferAllFiles\":false}}}")
                .toObject(TransferConfiguration.class);
        Assertions.assertEquals(TransferConfigurationType.TRANSFER_USING_FILTER, model.transferConfigurationType());
        Assertions
            .assertEquals(DataAccountType.STORAGE_ACCOUNT, model.transferFilterDetails().include().dataAccountType());
        Assertions
            .assertEquals(DataAccountType.STORAGE_ACCOUNT, model.transferAllDetails().include().dataAccountType());
        Assertions.assertEquals(true, model.transferAllDetails().include().transferAllBlobs());
        Assertions.assertEquals(false, model.transferAllDetails().include().transferAllFiles());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        TransferConfiguration model =
            new TransferConfiguration()
                .withTransferConfigurationType(TransferConfigurationType.TRANSFER_USING_FILTER)
                .withTransferFilterDetails(
                    new TransferConfigurationTransferFilterDetails()
                        .withInclude(
                            new TransferFilterDetails()
                                .withDataAccountType(DataAccountType.STORAGE_ACCOUNT)
                                .withFilterFileDetails(Arrays.asList())))
                .withTransferAllDetails(
                    new TransferConfigurationTransferAllDetails()
                        .withInclude(
                            new TransferAllDetails()
                                .withDataAccountType(DataAccountType.STORAGE_ACCOUNT)
                                .withTransferAllBlobs(true)
                                .withTransferAllFiles(false)));
        model = BinaryData.fromObject(model).toObject(TransferConfiguration.class);
        Assertions.assertEquals(TransferConfigurationType.TRANSFER_USING_FILTER, model.transferConfigurationType());
        Assertions
            .assertEquals(DataAccountType.STORAGE_ACCOUNT, model.transferFilterDetails().include().dataAccountType());
        Assertions
            .assertEquals(DataAccountType.STORAGE_ACCOUNT, model.transferAllDetails().include().dataAccountType());
        Assertions.assertEquals(true, model.transferAllDetails().include().transferAllBlobs());
        Assertions.assertEquals(false, model.transferAllDetails().include().transferAllFiles());
    }
}
