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

package com.azure.resourcemanager.mariadb.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.mariadb.models.GeoRedundantBackup;
import com.azure.resourcemanager.mariadb.models.MinimalTlsVersionEnum;
import com.azure.resourcemanager.mariadb.models.PublicNetworkAccessEnum;
import com.azure.resourcemanager.mariadb.models.ServerPropertiesForReplica;
import com.azure.resourcemanager.mariadb.models.ServerVersion;
import com.azure.resourcemanager.mariadb.models.SslEnforcementEnum;
import com.azure.resourcemanager.mariadb.models.StorageAutogrow;
import com.azure.resourcemanager.mariadb.models.StorageProfile;
import org.junit.jupiter.api.Assertions;

public final class ServerPropertiesForReplicaTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ServerPropertiesForReplica model =
            BinaryData
                .fromString(
                    "{\"createMode\":\"Replica\",\"sourceServerId\":\"qlpqwcciuq\",\"version\":\"10.3\",\"sslEnforcement\":\"Enabled\",\"minimalTlsVersion\":\"TLSEnforcementDisabled\",\"publicNetworkAccess\":\"Enabled\",\"storageProfile\":{\"backupRetentionDays\":1305719459,\"geoRedundantBackup\":\"Disabled\",\"storageMB\":752172532,\"storageAutogrow\":\"Disabled\"}}")
                .toObject(ServerPropertiesForReplica.class);
        Assertions.assertEquals(ServerVersion.ONE_ZERO_THREE, model.version());
        Assertions.assertEquals(SslEnforcementEnum.ENABLED, model.sslEnforcement());
        Assertions.assertEquals(MinimalTlsVersionEnum.TLSENFORCEMENT_DISABLED, model.minimalTlsVersion());
        Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess());
        Assertions.assertEquals(1305719459, model.storageProfile().backupRetentionDays());
        Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup());
        Assertions.assertEquals(752172532, model.storageProfile().storageMB());
        Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageProfile().storageAutogrow());
        Assertions.assertEquals("qlpqwcciuq", model.sourceServerId());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ServerPropertiesForReplica model =
            new ServerPropertiesForReplica()
                .withVersion(ServerVersion.ONE_ZERO_THREE)
                .withSslEnforcement(SslEnforcementEnum.ENABLED)
                .withMinimalTlsVersion(MinimalTlsVersionEnum.TLSENFORCEMENT_DISABLED)
                .withPublicNetworkAccess(PublicNetworkAccessEnum.ENABLED)
                .withStorageProfile(
                    new StorageProfile()
                        .withBackupRetentionDays(1305719459)
                        .withGeoRedundantBackup(GeoRedundantBackup.DISABLED)
                        .withStorageMB(752172532)
                        .withStorageAutogrow(StorageAutogrow.DISABLED))
                .withSourceServerId("qlpqwcciuq");
        model = BinaryData.fromObject(model).toObject(ServerPropertiesForReplica.class);
        Assertions.assertEquals(ServerVersion.ONE_ZERO_THREE, model.version());
        Assertions.assertEquals(SslEnforcementEnum.ENABLED, model.sslEnforcement());
        Assertions.assertEquals(MinimalTlsVersionEnum.TLSENFORCEMENT_DISABLED, model.minimalTlsVersion());
        Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess());
        Assertions.assertEquals(1305719459, model.storageProfile().backupRetentionDays());
        Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup());
        Assertions.assertEquals(752172532, model.storageProfile().storageMB());
        Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageProfile().storageAutogrow());
        Assertions.assertEquals("qlpqwcciuq", model.sourceServerId());
    }
}
