// 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.AzureFileShareProtectionPolicy;
import com.azure.resourcemanager.recoveryservicesbackup.models.RetentionPolicy;
import com.azure.resourcemanager.recoveryservicesbackup.models.SchedulePolicy;
import com.azure.resourcemanager.recoveryservicesbackup.models.WorkloadType;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class AzureFileShareProtectionPolicyTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        AzureFileShareProtectionPolicy model =
            BinaryData
                .fromString(
                    "{\"backupManagementType\":\"AzureStorage\",\"workLoadType\":\"GenericDataSource\",\"schedulePolicy\":{\"schedulePolicyType\":\"SchedulePolicy\"},\"retentionPolicy\":{\"retentionPolicyType\":\"RetentionPolicy\"},\"timeZone\":\"sjc\",\"protectedItemsCount\":2098917747,\"resourceGuardOperationRequests\":[\"ntiew\"]}")
                .toObject(AzureFileShareProtectionPolicy.class);
        Assertions.assertEquals(2098917747, model.protectedItemsCount());
        Assertions.assertEquals("ntiew", model.resourceGuardOperationRequests().get(0));
        Assertions.assertEquals(WorkloadType.GENERIC_DATA_SOURCE, model.workLoadType());
        Assertions.assertEquals("sjc", model.timeZone());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        AzureFileShareProtectionPolicy model =
            new AzureFileShareProtectionPolicy()
                .withProtectedItemsCount(2098917747)
                .withResourceGuardOperationRequests(Arrays.asList("ntiew"))
                .withWorkLoadType(WorkloadType.GENERIC_DATA_SOURCE)
                .withSchedulePolicy(new SchedulePolicy())
                .withRetentionPolicy(new RetentionPolicy())
                .withTimeZone("sjc");
        model = BinaryData.fromObject(model).toObject(AzureFileShareProtectionPolicy.class);
        Assertions.assertEquals(2098917747, model.protectedItemsCount());
        Assertions.assertEquals("ntiew", model.resourceGuardOperationRequests().get(0));
        Assertions.assertEquals(WorkloadType.GENERIC_DATA_SOURCE, model.workLoadType());
        Assertions.assertEquals("sjc", model.timeZone());
    }
}
