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

package com.azure.resourcemanager.cosmosdbforpostgresql.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ClusterServerProperties;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole;
import org.junit.jupiter.api.Assertions;

public final class ClusterServerPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ClusterServerProperties model =
            BinaryData
                .fromString(
                    "{\"fullyQualifiedDomainName\":\"rwzoxxjtfelluwf\",\"role\":\"Coordinator\",\"state\":\"np\",\"haState\":\"fpjkjlxofp\",\"availabilityZone\":\"hpf\",\"postgresqlVersion\":\"ypininm\",\"citusVersion\":\"huyb\",\"serverEdition\":\"podepoo\",\"storageQuotaInMb\":895630833,\"vCores\":1290742637,\"enableHa\":false,\"enablePublicIpAccess\":true,\"isReadOnly\":true,\"administratorLogin\":\"narxzxtheotus\"}")
                .toObject(ClusterServerProperties.class);
        Assertions.assertEquals("podepoo", model.serverEdition());
        Assertions.assertEquals(895630833, model.storageQuotaInMb());
        Assertions.assertEquals(1290742637, model.vCores());
        Assertions.assertEquals(false, model.enableHa());
        Assertions.assertEquals(ServerRole.COORDINATOR, model.role());
        Assertions.assertEquals("hpf", model.availabilityZone());
        Assertions.assertEquals("ypininm", model.postgresqlVersion());
        Assertions.assertEquals("huyb", model.citusVersion());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ClusterServerProperties model =
            new ClusterServerProperties()
                .withServerEdition("podepoo")
                .withStorageQuotaInMb(895630833)
                .withVCores(1290742637)
                .withEnableHa(false)
                .withRole(ServerRole.COORDINATOR)
                .withAvailabilityZone("hpf")
                .withPostgresqlVersion("ypininm")
                .withCitusVersion("huyb");
        model = BinaryData.fromObject(model).toObject(ClusterServerProperties.class);
        Assertions.assertEquals("podepoo", model.serverEdition());
        Assertions.assertEquals(895630833, model.storageQuotaInMb());
        Assertions.assertEquals(1290742637, model.vCores());
        Assertions.assertEquals(false, model.enableHa());
        Assertions.assertEquals(ServerRole.COORDINATOR, model.role());
        Assertions.assertEquals("hpf", model.availabilityZone());
        Assertions.assertEquals("ypininm", model.postgresqlVersion());
        Assertions.assertEquals("huyb", model.citusVersion());
    }
}
