# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2020 Raritan Inc. All rights reserved.
#
# This file was generated by IdlC from Security.idl.

use strict;

package Raritan::RPC::security::IpFw_1_0_1;

use Raritan::RPC::security::IpfwRule;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'enabled'} = ($in->{'enabled'}) ? JSON::true : JSON::false;
    $encoded->{'defaultPolicy'} = $in->{'defaultPolicy'};
    $encoded->{'ruleSet'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'ruleSet'}}; $i0++) {
        $encoded->{'ruleSet'}->[$i0] = Raritan::RPC::security::IpfwRule::encode($in->{'ruleSet'}->[$i0]);
    }
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'enabled'} = ($in->{'enabled'}) ? 1 : 0;
    $decoded->{'defaultPolicy'} = $in->{'defaultPolicy'};
    $decoded->{'ruleSet'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'ruleSet'}}; $i0++) {
        $decoded->{'ruleSet'}->[$i0] = Raritan::RPC::security::IpfwRule::decode($agent, $in->{'ruleSet'}->[$i0]);
    }
    return $decoded;
}

1;
