// 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.BackupDatasourceParameters;
import com.azure.resourcemanager.dataprotection.models.DataStoreParameters;
import com.azure.resourcemanager.dataprotection.models.DataStoreTypes;
import com.azure.resourcemanager.dataprotection.models.PolicyInfo;
import com.azure.resourcemanager.dataprotection.models.PolicyParameters;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PolicyInfoTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PolicyInfo model =
            BinaryData
                .fromString(
                    "{\"policyId\":\"mjmvxieduugidyjr\",\"policyVersion\":\"byao\",\"policyParameters\":{\"dataStoreParametersList\":[{\"objectType\":\"DataStoreParameters\",\"dataStoreType\":\"ArchiveStore\"}],\"backupDatasourceParametersList\":[{\"objectType\":\"BackupDatasourceParameters\"}]}}")
                .toObject(PolicyInfo.class);
        Assertions.assertEquals("mjmvxieduugidyjr", model.policyId());
        Assertions
            .assertEquals(
                DataStoreTypes.ARCHIVE_STORE,
                model.policyParameters().dataStoreParametersList().get(0).dataStoreType());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PolicyInfo model =
            new PolicyInfo()
                .withPolicyId("mjmvxieduugidyjr")
                .withPolicyParameters(
                    new PolicyParameters()
                        .withDataStoreParametersList(
                            Arrays.asList(new DataStoreParameters().withDataStoreType(DataStoreTypes.ARCHIVE_STORE)))
                        .withBackupDatasourceParametersList(Arrays.asList(new BackupDatasourceParameters())));
        model = BinaryData.fromObject(model).toObject(PolicyInfo.class);
        Assertions.assertEquals("mjmvxieduugidyjr", model.policyId());
        Assertions
            .assertEquals(
                DataStoreTypes.ARCHIVE_STORE,
                model.policyParameters().dataStoreParametersList().get(0).dataStoreType());
    }
}
