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

package com.azure.resourcemanager.azurearcdata.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.azurearcdata.models.ArcSqlServerLicenseType;
import com.azure.resourcemanager.azurearcdata.models.ConnectionStatus;
import com.azure.resourcemanager.azurearcdata.models.DefenderStatus;
import com.azure.resourcemanager.azurearcdata.models.EditionType;
import com.azure.resourcemanager.azurearcdata.models.SqlServerInstanceProperties;
import com.azure.resourcemanager.azurearcdata.models.SqlVersion;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class SqlServerInstancePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SqlServerInstanceProperties model =
            BinaryData
                .fromString(
                    "{\"version\":\"SQL Server"
                        + " 2017\",\"edition\":\"Evaluation\",\"containerResourceId\":\"eojnabc\",\"createTime\":\"smtxpsieb\",\"vCore\":\"hvpesapskrdqm\",\"status\":\"Unknown\",\"patchLevel\":\"dhtldwkyz\",\"collation\":\"utknc\",\"currentVersion\":\"cwsvlxotog\",\"instanceName\":\"rupqsxvnmicy\",\"tcpDynamicPorts\":\"ceoveilovno\",\"tcpStaticPorts\":\"fj\",\"productId\":\"njbkcnxdhbttkph\",\"licenseType\":\"Undefined\",\"azureDefenderStatusLastUpdated\":\"2021-09-28T11:00:41Z\",\"azureDefenderStatus\":\"Unknown\",\"provisioningState\":\"qnermclfplphoxu\"}")
                .toObject(SqlServerInstanceProperties.class);
        Assertions.assertEquals(SqlVersion.SQL_SERVER_2017, model.version());
        Assertions.assertEquals(EditionType.EVALUATION, model.edition());
        Assertions.assertEquals("eojnabc", model.containerResourceId());
        Assertions.assertEquals("hvpesapskrdqm", model.vCore());
        Assertions.assertEquals(ConnectionStatus.UNKNOWN, model.status());
        Assertions.assertEquals("dhtldwkyz", model.patchLevel());
        Assertions.assertEquals("utknc", model.collation());
        Assertions.assertEquals("cwsvlxotog", model.currentVersion());
        Assertions.assertEquals("rupqsxvnmicy", model.instanceName());
        Assertions.assertEquals("ceoveilovno", model.tcpDynamicPorts());
        Assertions.assertEquals("fj", model.tcpStaticPorts());
        Assertions.assertEquals("njbkcnxdhbttkph", model.productId());
        Assertions.assertEquals(ArcSqlServerLicenseType.UNDEFINED, model.licenseType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-28T11:00:41Z"), model.azureDefenderStatusLastUpdated());
        Assertions.assertEquals(DefenderStatus.UNKNOWN, model.azureDefenderStatus());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SqlServerInstanceProperties model =
            new SqlServerInstanceProperties()
                .withVersion(SqlVersion.SQL_SERVER_2017)
                .withEdition(EditionType.EVALUATION)
                .withContainerResourceId("eojnabc")
                .withVCore("hvpesapskrdqm")
                .withStatus(ConnectionStatus.UNKNOWN)
                .withPatchLevel("dhtldwkyz")
                .withCollation("utknc")
                .withCurrentVersion("cwsvlxotog")
                .withInstanceName("rupqsxvnmicy")
                .withTcpDynamicPorts("ceoveilovno")
                .withTcpStaticPorts("fj")
                .withProductId("njbkcnxdhbttkph")
                .withLicenseType(ArcSqlServerLicenseType.UNDEFINED)
                .withAzureDefenderStatusLastUpdated(OffsetDateTime.parse("2021-09-28T11:00:41Z"))
                .withAzureDefenderStatus(DefenderStatus.UNKNOWN);
        model = BinaryData.fromObject(model).toObject(SqlServerInstanceProperties.class);
        Assertions.assertEquals(SqlVersion.SQL_SERVER_2017, model.version());
        Assertions.assertEquals(EditionType.EVALUATION, model.edition());
        Assertions.assertEquals("eojnabc", model.containerResourceId());
        Assertions.assertEquals("hvpesapskrdqm", model.vCore());
        Assertions.assertEquals(ConnectionStatus.UNKNOWN, model.status());
        Assertions.assertEquals("dhtldwkyz", model.patchLevel());
        Assertions.assertEquals("utknc", model.collation());
        Assertions.assertEquals("cwsvlxotog", model.currentVersion());
        Assertions.assertEquals("rupqsxvnmicy", model.instanceName());
        Assertions.assertEquals("ceoveilovno", model.tcpDynamicPorts());
        Assertions.assertEquals("fj", model.tcpStaticPorts());
        Assertions.assertEquals("njbkcnxdhbttkph", model.productId());
        Assertions.assertEquals(ArcSqlServerLicenseType.UNDEFINED, model.licenseType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-09-28T11:00:41Z"), model.azureDefenderStatusLastUpdated());
        Assertions.assertEquals(DefenderStatus.UNKNOWN, model.azureDefenderStatus());
    }
}
