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

package com.azure.resourcemanager.synapse.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.synapse.fluent.models.SqlPoolResourceProperties;
import com.azure.resourcemanager.synapse.models.CreateMode;
import com.azure.resourcemanager.synapse.models.StorageAccountType;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class SqlPoolResourcePropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        SqlPoolResourceProperties model =
            BinaryData
                .fromString(
                    "{\"maxSizeBytes\":547148134768197922,\"collation\":\"vtq\",\"sourceDatabaseId\":\"n\",\"recoverableDatabaseId\":\"ynhijggme\",\"provisioningState\":\"siarbutrcvpn\",\"status\":\"zmhjrunmp\",\"restorePointInTime\":\"2021-03-04T22:45:41Z\",\"createMode\":\"Default\",\"creationDate\":\"2021-07-16T15:39:21Z\",\"storageAccountType\":\"LRS\",\"sourceDatabaseDeletionDate\":\"2021-10-27T21:49:11Z\"}")
                .toObject(SqlPoolResourceProperties.class);
        Assertions.assertEquals(547148134768197922L, model.maxSizeBytes());
        Assertions.assertEquals("vtq", model.collation());
        Assertions.assertEquals("n", model.sourceDatabaseId());
        Assertions.assertEquals("ynhijggme", model.recoverableDatabaseId());
        Assertions.assertEquals("siarbutrcvpn", model.provisioningState());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-04T22:45:41Z"), model.restorePointInTime());
        Assertions.assertEquals(CreateMode.DEFAULT, model.createMode());
        Assertions.assertEquals(StorageAccountType.LRS, model.storageAccountType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-27T21:49:11Z"), model.sourceDatabaseDeletionDate());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        SqlPoolResourceProperties model =
            new SqlPoolResourceProperties()
                .withMaxSizeBytes(547148134768197922L)
                .withCollation("vtq")
                .withSourceDatabaseId("n")
                .withRecoverableDatabaseId("ynhijggme")
                .withProvisioningState("siarbutrcvpn")
                .withRestorePointInTime(OffsetDateTime.parse("2021-03-04T22:45:41Z"))
                .withCreateMode(CreateMode.DEFAULT)
                .withStorageAccountType(StorageAccountType.LRS)
                .withSourceDatabaseDeletionDate(OffsetDateTime.parse("2021-10-27T21:49:11Z"));
        model = BinaryData.fromObject(model).toObject(SqlPoolResourceProperties.class);
        Assertions.assertEquals(547148134768197922L, model.maxSizeBytes());
        Assertions.assertEquals("vtq", model.collation());
        Assertions.assertEquals("n", model.sourceDatabaseId());
        Assertions.assertEquals("ynhijggme", model.recoverableDatabaseId());
        Assertions.assertEquals("siarbutrcvpn", model.provisioningState());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-04T22:45:41Z"), model.restorePointInTime());
        Assertions.assertEquals(CreateMode.DEFAULT, model.createMode());
        Assertions.assertEquals(StorageAccountType.LRS, model.storageAccountType());
        Assertions.assertEquals(OffsetDateTime.parse("2021-10-27T21:49:11Z"), model.sourceDatabaseDeletionDate());
    }
}
