// 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.ClusterServerInner;
import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole;
import org.junit.jupiter.api.Assertions;

public final class ClusterServerInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ClusterServerInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"fullyQualifiedDomainName\":\"atscmd\",\"role\":\"Worker\",\"state\":\"u\",\"haState\":\"uuvmkjozkrwfnd\",\"availabilityZone\":\"djpslw\",\"postgresqlVersion\":\"dpvwryoqpsoaccta\",\"citusVersion\":\"kljla\",\"serverEdition\":\"cr\",\"storageQuotaInMb\":1060950423,\"vCores\":1389039399,\"enableHa\":false,\"enablePublicIpAccess\":true,\"isReadOnly\":false,\"administratorLogin\":\"paojakhmsbzjh\"},\"id\":\"zevdphlx\",\"name\":\"olthqtrgqjbp\",\"type\":\"zfsinzgvf\"}")
                .toObject(ClusterServerInner.class);
        Assertions.assertEquals(ServerRole.WORKER, model.role());
        Assertions.assertEquals("djpslw", model.availabilityZone());
        Assertions.assertEquals("dpvwryoqpsoaccta", model.postgresqlVersion());
        Assertions.assertEquals("kljla", model.citusVersion());
        Assertions.assertEquals("cr", model.serverEdition());
        Assertions.assertEquals(1060950423, model.storageQuotaInMb());
        Assertions.assertEquals(1389039399, model.vCores());
        Assertions.assertEquals(false, model.enableHa());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        ClusterServerInner model =
            new ClusterServerInner()
                .withRole(ServerRole.WORKER)
                .withAvailabilityZone("djpslw")
                .withPostgresqlVersion("dpvwryoqpsoaccta")
                .withCitusVersion("kljla")
                .withServerEdition("cr")
                .withStorageQuotaInMb(1060950423)
                .withVCores(1389039399)
                .withEnableHa(false);
        model = BinaryData.fromObject(model).toObject(ClusterServerInner.class);
        Assertions.assertEquals(ServerRole.WORKER, model.role());
        Assertions.assertEquals("djpslw", model.availabilityZone());
        Assertions.assertEquals("dpvwryoqpsoaccta", model.postgresqlVersion());
        Assertions.assertEquals("kljla", model.citusVersion());
        Assertions.assertEquals("cr", model.serverEdition());
        Assertions.assertEquals(1060950423, model.storageQuotaInMb());
        Assertions.assertEquals(1389039399, model.vCores());
        Assertions.assertEquals(false, model.enableHa());
    }
}
