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

package com.azure.resourcemanager.paloaltonetworks.ngfw.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.paloaltonetworks.ngfw.fluent.models.LocalRulesResourceInner;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.ActionEnum;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.BooleanEnum;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.DecryptionRuleTypeEnum;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.LocalRulesResourceListResult;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.StateEnum;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class LocalRulesResourceListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        LocalRulesResourceListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"etag\":\"rkambt\",\"ruleName\":\"negvmnvuqe\",\"priority\":640120978,\"description\":\"spastjbkkdmf\",\"ruleState\":\"DISABLED\",\"negateSource\":\"FALSE\",\"negateDestination\":\"FALSE\",\"applications\":[],\"protocol\":\"lozapeewchpxlk\",\"protocolPortList\":[],\"inboundInspectionCertificate\":\"uziycsl\",\"auditComment\":\"ufuztcktyhjtq\",\"actionType\":\"DenyResetBoth\",\"enableLogging\":\"ENABLED\",\"decryptionRuleType\":\"SSLOutboundInspection\",\"tags\":[],\"provisioningState\":\"Deleting\"},\"id\":\"qzz\",\"name\":\"rjvpglydzgkrvqee\",\"type\":\"toepryu\"}],\"nextLink\":\"wytpzdmovz\"}")
                .toObject(LocalRulesResourceListResult.class);
        Assertions.assertEquals("rkambt", model.value().get(0).etag());
        Assertions.assertEquals("negvmnvuqe", model.value().get(0).ruleName());
        Assertions.assertEquals("spastjbkkdmf", model.value().get(0).description());
        Assertions.assertEquals(StateEnum.DISABLED, model.value().get(0).ruleState());
        Assertions.assertEquals(BooleanEnum.FALSE, model.value().get(0).negateSource());
        Assertions.assertEquals(BooleanEnum.FALSE, model.value().get(0).negateDestination());
        Assertions.assertEquals("lozapeewchpxlk", model.value().get(0).protocol());
        Assertions.assertEquals("uziycsl", model.value().get(0).inboundInspectionCertificate());
        Assertions.assertEquals("ufuztcktyhjtq", model.value().get(0).auditComment());
        Assertions.assertEquals(ActionEnum.DENY_RESET_BOTH, model.value().get(0).actionType());
        Assertions.assertEquals(StateEnum.ENABLED, model.value().get(0).enableLogging());
        Assertions
            .assertEquals(DecryptionRuleTypeEnum.SSLOUTBOUND_INSPECTION, model.value().get(0).decryptionRuleType());
        Assertions.assertEquals("wytpzdmovz", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        LocalRulesResourceListResult model =
            new LocalRulesResourceListResult()
                .withValue(
                    Arrays
                        .asList(
                            new LocalRulesResourceInner()
                                .withEtag("rkambt")
                                .withRuleName("negvmnvuqe")
                                .withDescription("spastjbkkdmf")
                                .withRuleState(StateEnum.DISABLED)
                                .withNegateSource(BooleanEnum.FALSE)
                                .withNegateDestination(BooleanEnum.FALSE)
                                .withApplications(Arrays.asList())
                                .withProtocol("lozapeewchpxlk")
                                .withProtocolPortList(Arrays.asList())
                                .withInboundInspectionCertificate("uziycsl")
                                .withAuditComment("ufuztcktyhjtq")
                                .withActionType(ActionEnum.DENY_RESET_BOTH)
                                .withEnableLogging(StateEnum.ENABLED)
                                .withDecryptionRuleType(DecryptionRuleTypeEnum.SSLOUTBOUND_INSPECTION)
                                .withTags(Arrays.asList())))
                .withNextLink("wytpzdmovz");
        model = BinaryData.fromObject(model).toObject(LocalRulesResourceListResult.class);
        Assertions.assertEquals("rkambt", model.value().get(0).etag());
        Assertions.assertEquals("negvmnvuqe", model.value().get(0).ruleName());
        Assertions.assertEquals("spastjbkkdmf", model.value().get(0).description());
        Assertions.assertEquals(StateEnum.DISABLED, model.value().get(0).ruleState());
        Assertions.assertEquals(BooleanEnum.FALSE, model.value().get(0).negateSource());
        Assertions.assertEquals(BooleanEnum.FALSE, model.value().get(0).negateDestination());
        Assertions.assertEquals("lozapeewchpxlk", model.value().get(0).protocol());
        Assertions.assertEquals("uziycsl", model.value().get(0).inboundInspectionCertificate());
        Assertions.assertEquals("ufuztcktyhjtq", model.value().get(0).auditComment());
        Assertions.assertEquals(ActionEnum.DENY_RESET_BOTH, model.value().get(0).actionType());
        Assertions.assertEquals(StateEnum.ENABLED, model.value().get(0).enableLogging());
        Assertions
            .assertEquals(DecryptionRuleTypeEnum.SSLOUTBOUND_INSPECTION, model.value().get(0).decryptionRuleType());
        Assertions.assertEquals("wytpzdmovz", model.nextLink());
    }
}
