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

package com.azure.resourcemanager.frontdoor.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.frontdoor.fluent.models.FrontendEndpointInner;
import com.azure.resourcemanager.frontdoor.models.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink;
import com.azure.resourcemanager.frontdoor.models.SessionAffinityEnabledState;
import org.junit.jupiter.api.Assertions;

public final class FrontendEndpointInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        FrontendEndpointInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"resourceState\":\"Disabled\",\"customHttpsProvisioningState\":\"Failed\",\"customHttpsProvisioningSubstate\":\"CertificateDeployed\",\"customHttpsConfiguration\":{\"certificateSource\":\"FrontDoor\",\"protocolType\":\"ServerNameIndication\",\"minimumTlsVersion\":\"1.0\"},\"hostName\":\"iexpbtgiwbwo\",\"sessionAffinityEnabledState\":\"Enabled\",\"sessionAffinityTtlSeconds\":1338594793,\"webApplicationFirewallPolicyLink\":{\"id\":\"tdtkcn\"}},\"name\":\"wbpokulpiujwaasi\",\"type\":\"i\",\"id\":\"byuqerpqlp\"}")
                .toObject(FrontendEndpointInner.class);
        Assertions.assertEquals("byuqerpqlp", model.id());
        Assertions.assertEquals("wbpokulpiujwaasi", model.name());
        Assertions.assertEquals("iexpbtgiwbwo", model.hostname());
        Assertions.assertEquals(SessionAffinityEnabledState.ENABLED, model.sessionAffinityEnabledState());
        Assertions.assertEquals(1338594793, model.sessionAffinityTtlSeconds());
        Assertions.assertEquals("tdtkcn", model.webApplicationFirewallPolicyLink().id());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        FrontendEndpointInner model =
            new FrontendEndpointInner()
                .withId("byuqerpqlp")
                .withName("wbpokulpiujwaasi")
                .withHostname("iexpbtgiwbwo")
                .withSessionAffinityEnabledState(SessionAffinityEnabledState.ENABLED)
                .withSessionAffinityTtlSeconds(1338594793)
                .withWebApplicationFirewallPolicyLink(
                    new FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink().withId("tdtkcn"));
        model = BinaryData.fromObject(model).toObject(FrontendEndpointInner.class);
        Assertions.assertEquals("byuqerpqlp", model.id());
        Assertions.assertEquals("wbpokulpiujwaasi", model.name());
        Assertions.assertEquals("iexpbtgiwbwo", model.hostname());
        Assertions.assertEquals(SessionAffinityEnabledState.ENABLED, model.sessionAffinityEnabledState());
        Assertions.assertEquals(1338594793, model.sessionAffinityTtlSeconds());
        Assertions.assertEquals("tdtkcn", model.webApplicationFirewallPolicyLink().id());
    }
}
