// 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.ImmutabilitySettings;
import com.azure.resourcemanager.dataprotection.models.ImmutabilityState;
import com.azure.resourcemanager.dataprotection.models.SecuritySettings;
import com.azure.resourcemanager.dataprotection.models.SoftDeleteSettings;
import com.azure.resourcemanager.dataprotection.models.SoftDeleteState;
import org.junit.jupiter.api.Assertions;

public final class SecuritySettingsTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SecuritySettings model =
            BinaryData
                .fromString(
                    "{\"softDeleteSettings\":{\"state\":\"On\",\"retentionDurationInDays\":76.87214061401316},\"immutabilitySettings\":{\"state\":\"Locked\"}}")
                .toObject(SecuritySettings.class);
        Assertions.assertEquals(SoftDeleteState.ON, model.softDeleteSettings().state());
        Assertions.assertEquals(76.87214061401316D, model.softDeleteSettings().retentionDurationInDays());
        Assertions.assertEquals(ImmutabilityState.LOCKED, model.immutabilitySettings().state());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SecuritySettings model =
            new SecuritySettings()
                .withSoftDeleteSettings(
                    new SoftDeleteSettings()
                        .withState(SoftDeleteState.ON)
                        .withRetentionDurationInDays(76.87214061401316D))
                .withImmutabilitySettings(new ImmutabilitySettings().withState(ImmutabilityState.LOCKED));
        model = BinaryData.fromObject(model).toObject(SecuritySettings.class);
        Assertions.assertEquals(SoftDeleteState.ON, model.softDeleteSettings().state());
        Assertions.assertEquals(76.87214061401316D, model.softDeleteSettings().retentionDurationInDays());
        Assertions.assertEquals(ImmutabilityState.LOCKED, model.immutabilitySettings().state());
    }
}
