// 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.PreRulesResourceInner;
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.PreRulesResourceListResult;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.StateEnum;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class PreRulesResourceListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PreRulesResourceListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"etag\":\"ebmnzbtbhjpglk\",\"ruleName\":\"gohdneuelfphsd\",\"priority\":58245942,\"description\":\"zfikd\",\"ruleState\":\"DISABLED\",\"negateSource\":\"FALSE\",\"negateDestination\":\"TRUE\",\"applications\":[],\"protocol\":\"vithh\",\"protocolPortList\":[],\"inboundInspectionCertificate\":\"nosggbhcoh\",\"auditComment\":\"dsjnka\",\"actionType\":\"DenyResetServer\",\"enableLogging\":\"ENABLED\",\"decryptionRuleType\":\"SSLOutboundInspection\",\"tags\":[],\"provisioningState\":\"Creating\"},\"id\":\"fgdkzzew\",\"name\":\"fvhqc\",\"type\":\"a\"},{\"properties\":{\"etag\":\"vpnpp\",\"ruleName\":\"uflrwd\",\"priority\":1982601986,\"description\":\"xyjrxsagafcnih\",\"ruleState\":\"ENABLED\",\"negateSource\":\"TRUE\",\"negateDestination\":\"TRUE\",\"applications\":[],\"protocol\":\"vkcvqvpkeqd\",\"protocolPortList\":[],\"inboundInspectionCertificate\":\"rhvoods\",\"auditComment\":\"bobzdopcjwvnhd\",\"actionType\":\"DenyResetServer\",\"enableLogging\":\"DISABLED\",\"decryptionRuleType\":\"None\",\"tags\":[],\"provisioningState\":\"Creating\"},\"id\":\"pmutwuo\",\"name\":\"grpkhjwniyqs\",\"type\":\"uicpd\"},{\"properties\":{\"etag\":\"kzzlvmbmpaxmodf\",\"ruleName\":\"uefywsbpfvmwy\",\"priority\":1337725410,\"description\":\"uyfta\",\"ruleState\":\"DISABLED\",\"negateSource\":\"FALSE\",\"negateDestination\":\"TRUE\",\"applications\":[],\"protocol\":\"nubexk\",\"protocolPortList\":[],\"inboundInspectionCertificate\":\"smond\",\"auditComment\":\"quxvypomgkop\",\"actionType\":\"DenyResetBoth\",\"enableLogging\":\"DISABLED\",\"decryptionRuleType\":\"SSLOutboundInspection\",\"tags\":[],\"provisioningState\":\"Canceled\"},\"id\":\"xysmoc\",\"name\":\"bq\",\"type\":\"qvmkcxo\"}],\"nextLink\":\"pvhelxprg\"}")
                .toObject(PreRulesResourceListResult.class);
        Assertions.assertEquals("ebmnzbtbhjpglk", model.value().get(0).etag());
        Assertions.assertEquals("gohdneuelfphsd", model.value().get(0).ruleName());
        Assertions.assertEquals("zfikd", 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.TRUE, model.value().get(0).negateDestination());
        Assertions.assertEquals("vithh", model.value().get(0).protocol());
        Assertions.assertEquals("nosggbhcoh", model.value().get(0).inboundInspectionCertificate());
        Assertions.assertEquals("dsjnka", model.value().get(0).auditComment());
        Assertions.assertEquals(ActionEnum.DENY_RESET_SERVER, 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("pvhelxprg", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PreRulesResourceListResult model =
            new PreRulesResourceListResult()
                .withValue(
                    Arrays
                        .asList(
                            new PreRulesResourceInner()
                                .withEtag("ebmnzbtbhjpglk")
                                .withRuleName("gohdneuelfphsd")
                                .withDescription("zfikd")
                                .withRuleState(StateEnum.DISABLED)
                                .withNegateSource(BooleanEnum.FALSE)
                                .withNegateDestination(BooleanEnum.TRUE)
                                .withApplications(Arrays.asList())
                                .withProtocol("vithh")
                                .withProtocolPortList(Arrays.asList())
                                .withInboundInspectionCertificate("nosggbhcoh")
                                .withAuditComment("dsjnka")
                                .withActionType(ActionEnum.DENY_RESET_SERVER)
                                .withEnableLogging(StateEnum.ENABLED)
                                .withDecryptionRuleType(DecryptionRuleTypeEnum.SSLOUTBOUND_INSPECTION)
                                .withTags(Arrays.asList()),
                            new PreRulesResourceInner()
                                .withEtag("vpnpp")
                                .withRuleName("uflrwd")
                                .withDescription("xyjrxsagafcnih")
                                .withRuleState(StateEnum.ENABLED)
                                .withNegateSource(BooleanEnum.TRUE)
                                .withNegateDestination(BooleanEnum.TRUE)
                                .withApplications(Arrays.asList())
                                .withProtocol("vkcvqvpkeqd")
                                .withProtocolPortList(Arrays.asList())
                                .withInboundInspectionCertificate("rhvoods")
                                .withAuditComment("bobzdopcjwvnhd")
                                .withActionType(ActionEnum.DENY_RESET_SERVER)
                                .withEnableLogging(StateEnum.DISABLED)
                                .withDecryptionRuleType(DecryptionRuleTypeEnum.NONE)
                                .withTags(Arrays.asList()),
                            new PreRulesResourceInner()
                                .withEtag("kzzlvmbmpaxmodf")
                                .withRuleName("uefywsbpfvmwy")
                                .withDescription("uyfta")
                                .withRuleState(StateEnum.DISABLED)
                                .withNegateSource(BooleanEnum.FALSE)
                                .withNegateDestination(BooleanEnum.TRUE)
                                .withApplications(Arrays.asList())
                                .withProtocol("nubexk")
                                .withProtocolPortList(Arrays.asList())
                                .withInboundInspectionCertificate("smond")
                                .withAuditComment("quxvypomgkop")
                                .withActionType(ActionEnum.DENY_RESET_BOTH)
                                .withEnableLogging(StateEnum.DISABLED)
                                .withDecryptionRuleType(DecryptionRuleTypeEnum.SSLOUTBOUND_INSPECTION)
                                .withTags(Arrays.asList())))
                .withNextLink("pvhelxprg");
        model = BinaryData.fromObject(model).toObject(PreRulesResourceListResult.class);
        Assertions.assertEquals("ebmnzbtbhjpglk", model.value().get(0).etag());
        Assertions.assertEquals("gohdneuelfphsd", model.value().get(0).ruleName());
        Assertions.assertEquals("zfikd", 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.TRUE, model.value().get(0).negateDestination());
        Assertions.assertEquals("vithh", model.value().get(0).protocol());
        Assertions.assertEquals("nosggbhcoh", model.value().get(0).inboundInspectionCertificate());
        Assertions.assertEquals("dsjnka", model.value().get(0).auditComment());
        Assertions.assertEquals(ActionEnum.DENY_RESET_SERVER, 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("pvhelxprg", model.nextLink());
    }
}
