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

public final class PostRulesResourceListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        PostRulesResourceListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"etag\":\"ldngkpoci\",\"ruleName\":\"azyxoegukg\",\"priority\":642461794,\"description\":\"ucgygevqz\",\"ruleState\":\"DISABLED\",\"negateSource\":\"TRUE\",\"negateDestination\":\"FALSE\",\"applications\":[],\"protocol\":\"r\",\"protocolPortList\":[],\"inboundInspectionCertificate\":\"dpydn\",\"auditComment\":\"hxdeoejz\",\"actionType\":\"Allow\",\"enableLogging\":\"DISABLED\",\"decryptionRuleType\":\"None\",\"tags\":[],\"provisioningState\":\"Succeeded\"},\"id\":\"fbishcbkha\",\"name\":\"deyeamdphagalpbu\",\"type\":\"wgipwhono\"},{\"properties\":{\"etag\":\"gshwankixz\",\"ruleName\":\"injep\",\"priority\":1086025239,\"description\":\"rywn\",\"ruleState\":\"ENABLED\",\"negateSource\":\"FALSE\",\"negateDestination\":\"FALSE\",\"applications\":[],\"protocol\":\"kcqvyxl\",\"protocolPortList\":[],\"inboundInspectionCertificate\":\"lsicohoqqnwv\",\"auditComment\":\"yav\",\"actionType\":\"Allow\",\"enableLogging\":\"DISABLED\",\"decryptionRuleType\":\"SSLOutboundInspection\",\"tags\":[],\"provisioningState\":\"Failed\"},\"id\":\"yxzk\",\"name\":\"noc\",\"type\":\"koklya\"},{\"properties\":{\"etag\":\"conuqszfkbeype\",\"ruleName\":\"rmjmwvvjektc\",\"priority\":1803945661,\"description\":\"hwlrsf\",\"ruleState\":\"DISABLED\",\"negateSource\":\"TRUE\",\"negateDestination\":\"FALSE\",\"applications\":[],\"protocol\":\"iqylihkaetck\",\"protocolPortList\":[],\"inboundInspectionCertificate\":\"civfsnkymuctq\",\"auditComment\":\"fbebrjcxer\",\"actionType\":\"DenyResetServer\",\"enableLogging\":\"ENABLED\",\"decryptionRuleType\":\"None\",\"tags\":[],\"provisioningState\":\"Updating\"},\"id\":\"rbirphxe\",\"name\":\"c\",\"type\":\"vahfn\"},{\"properties\":{\"etag\":\"kyqxjvuujqgidokg\",\"ruleName\":\"ljyoxgvcltb\",\"priority\":1745548413,\"description\":\"ghkjeszzhbi\",\"ruleState\":\"DISABLED\",\"negateSource\":\"TRUE\",\"negateDestination\":\"TRUE\",\"applications\":[],\"protocol\":\"xnehmpvec\",\"protocolPortList\":[],\"inboundInspectionCertificate\":\"debfqkkrbmpukgri\",\"auditComment\":\"lzlfbxzpuz\",\"actionType\":\"DenyResetBoth\",\"enableLogging\":\"DISABLED\",\"decryptionRuleType\":\"None\",\"tags\":[],\"provisioningState\":\"Failed\"},\"id\":\"gkbrpyyd\",\"name\":\"ibnuqqkpik\",\"type\":\"drgvtqagn\"}],\"nextLink\":\"ynhijggme\"}")
                .toObject(PostRulesResourceListResult.class);
        Assertions.assertEquals("ldngkpoci", model.value().get(0).etag());
        Assertions.assertEquals("azyxoegukg", model.value().get(0).ruleName());
        Assertions.assertEquals("ucgygevqz", model.value().get(0).description());
        Assertions.assertEquals(StateEnum.DISABLED, model.value().get(0).ruleState());
        Assertions.assertEquals(BooleanEnum.TRUE, model.value().get(0).negateSource());
        Assertions.assertEquals(BooleanEnum.FALSE, model.value().get(0).negateDestination());
        Assertions.assertEquals("r", model.value().get(0).protocol());
        Assertions.assertEquals("dpydn", model.value().get(0).inboundInspectionCertificate());
        Assertions.assertEquals("hxdeoejz", model.value().get(0).auditComment());
        Assertions.assertEquals(ActionEnum.ALLOW, model.value().get(0).actionType());
        Assertions.assertEquals(StateEnum.DISABLED, model.value().get(0).enableLogging());
        Assertions.assertEquals(DecryptionRuleTypeEnum.NONE, model.value().get(0).decryptionRuleType());
        Assertions.assertEquals("ynhijggme", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        PostRulesResourceListResult model =
            new PostRulesResourceListResult()
                .withValue(
                    Arrays
                        .asList(
                            new PostRulesResourceInner()
                                .withEtag("ldngkpoci")
                                .withRuleName("azyxoegukg")
                                .withDescription("ucgygevqz")
                                .withRuleState(StateEnum.DISABLED)
                                .withNegateSource(BooleanEnum.TRUE)
                                .withNegateDestination(BooleanEnum.FALSE)
                                .withApplications(Arrays.asList())
                                .withProtocol("r")
                                .withProtocolPortList(Arrays.asList())
                                .withInboundInspectionCertificate("dpydn")
                                .withAuditComment("hxdeoejz")
                                .withActionType(ActionEnum.ALLOW)
                                .withEnableLogging(StateEnum.DISABLED)
                                .withDecryptionRuleType(DecryptionRuleTypeEnum.NONE)
                                .withTags(Arrays.asList()),
                            new PostRulesResourceInner()
                                .withEtag("gshwankixz")
                                .withRuleName("injep")
                                .withDescription("rywn")
                                .withRuleState(StateEnum.ENABLED)
                                .withNegateSource(BooleanEnum.FALSE)
                                .withNegateDestination(BooleanEnum.FALSE)
                                .withApplications(Arrays.asList())
                                .withProtocol("kcqvyxl")
                                .withProtocolPortList(Arrays.asList())
                                .withInboundInspectionCertificate("lsicohoqqnwv")
                                .withAuditComment("yav")
                                .withActionType(ActionEnum.ALLOW)
                                .withEnableLogging(StateEnum.DISABLED)
                                .withDecryptionRuleType(DecryptionRuleTypeEnum.SSLOUTBOUND_INSPECTION)
                                .withTags(Arrays.asList()),
                            new PostRulesResourceInner()
                                .withEtag("conuqszfkbeype")
                                .withRuleName("rmjmwvvjektc")
                                .withDescription("hwlrsf")
                                .withRuleState(StateEnum.DISABLED)
                                .withNegateSource(BooleanEnum.TRUE)
                                .withNegateDestination(BooleanEnum.FALSE)
                                .withApplications(Arrays.asList())
                                .withProtocol("iqylihkaetck")
                                .withProtocolPortList(Arrays.asList())
                                .withInboundInspectionCertificate("civfsnkymuctq")
                                .withAuditComment("fbebrjcxer")
                                .withActionType(ActionEnum.DENY_RESET_SERVER)
                                .withEnableLogging(StateEnum.ENABLED)
                                .withDecryptionRuleType(DecryptionRuleTypeEnum.NONE)
                                .withTags(Arrays.asList()),
                            new PostRulesResourceInner()
                                .withEtag("kyqxjvuujqgidokg")
                                .withRuleName("ljyoxgvcltb")
                                .withDescription("ghkjeszzhbi")
                                .withRuleState(StateEnum.DISABLED)
                                .withNegateSource(BooleanEnum.TRUE)
                                .withNegateDestination(BooleanEnum.TRUE)
                                .withApplications(Arrays.asList())
                                .withProtocol("xnehmpvec")
                                .withProtocolPortList(Arrays.asList())
                                .withInboundInspectionCertificate("debfqkkrbmpukgri")
                                .withAuditComment("lzlfbxzpuz")
                                .withActionType(ActionEnum.DENY_RESET_BOTH)
                                .withEnableLogging(StateEnum.DISABLED)
                                .withDecryptionRuleType(DecryptionRuleTypeEnum.NONE)
                                .withTags(Arrays.asList())))
                .withNextLink("ynhijggme");
        model = BinaryData.fromObject(model).toObject(PostRulesResourceListResult.class);
        Assertions.assertEquals("ldngkpoci", model.value().get(0).etag());
        Assertions.assertEquals("azyxoegukg", model.value().get(0).ruleName());
        Assertions.assertEquals("ucgygevqz", model.value().get(0).description());
        Assertions.assertEquals(StateEnum.DISABLED, model.value().get(0).ruleState());
        Assertions.assertEquals(BooleanEnum.TRUE, model.value().get(0).negateSource());
        Assertions.assertEquals(BooleanEnum.FALSE, model.value().get(0).negateDestination());
        Assertions.assertEquals("r", model.value().get(0).protocol());
        Assertions.assertEquals("dpydn", model.value().get(0).inboundInspectionCertificate());
        Assertions.assertEquals("hxdeoejz", model.value().get(0).auditComment());
        Assertions.assertEquals(ActionEnum.ALLOW, model.value().get(0).actionType());
        Assertions.assertEquals(StateEnum.DISABLED, model.value().get(0).enableLogging());
        Assertions.assertEquals(DecryptionRuleTypeEnum.NONE, model.value().get(0).decryptionRuleType());
        Assertions.assertEquals("ynhijggme", model.nextLink());
    }
}
