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

use strict;

package Raritan::RPC::net::NetworkActiveValuesIPv6;

use Raritan::RPC::net::IPv6RoutingEntry;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'enabled'} = ($in->{'enabled'}) ? JSON::true : JSON::false;
    $encoded->{'autocfg'} = $in->{'autocfg'};
    $encoded->{'ipaddrs'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'ipaddrs'}}; $i0++) {
        $encoded->{'ipaddrs'}->[$i0] = "$in->{'ipaddrs'}->[$i0]";
    }
    $encoded->{'routes'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'routes'}}; $i0++) {
        $encoded->{'routes'}->[$i0] = Raritan::RPC::net::IPv6RoutingEntry::encode($in->{'routes'}->[$i0]);
    }
    $encoded->{'ra_managed'} = ($in->{'ra_managed'}) ? JSON::true : JSON::false;
    $encoded->{'ra_otherconf'} = ($in->{'ra_otherconf'}) ? JSON::true : JSON::false;
    $encoded->{'dns_suffixes'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'dns_suffixes'}}; $i0++) {
        $encoded->{'dns_suffixes'}->[$i0] = "$in->{'dns_suffixes'}->[$i0]";
    }
    $encoded->{'dns_ip_1'} = "$in->{'dns_ip_1'}";
    $encoded->{'dns_ip_2'} = "$in->{'dns_ip_2'}";
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'enabled'} = ($in->{'enabled'}) ? 1 : 0;
    $decoded->{'autocfg'} = $in->{'autocfg'};
    $decoded->{'ipaddrs'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'ipaddrs'}}; $i0++) {
        $decoded->{'ipaddrs'}->[$i0] = $in->{'ipaddrs'}->[$i0];
    }
    $decoded->{'routes'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'routes'}}; $i0++) {
        $decoded->{'routes'}->[$i0] = Raritan::RPC::net::IPv6RoutingEntry::decode($agent, $in->{'routes'}->[$i0]);
    }
    $decoded->{'ra_managed'} = ($in->{'ra_managed'}) ? 1 : 0;
    $decoded->{'ra_otherconf'} = ($in->{'ra_otherconf'}) ? 1 : 0;
    $decoded->{'dns_suffixes'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'dns_suffixes'}}; $i0++) {
        $decoded->{'dns_suffixes'}->[$i0] = $in->{'dns_suffixes'}->[$i0];
    }
    $decoded->{'dns_ip_1'} = $in->{'dns_ip_1'};
    $decoded->{'dns_ip_2'} = $in->{'dns_ip_2'};
    return $decoded;
}

1;
