# 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::NetworkConfigIPv6;


sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'enabled'} = ($in->{'enabled'}) ? JSON::true : JSON::false;
    $encoded->{'autocfg'} = $in->{'autocfg'};
    $encoded->{'ipaddr'} = "$in->{'ipaddr'}";
    $encoded->{'gateway'} = "$in->{'gateway'}";
    $encoded->{'hostname'} = "$in->{'hostname'}";
    $encoded->{'dns_suffixes'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'dns_suffixes'}}; $i0++) {
        $encoded->{'dns_suffixes'}->[$i0] = "$in->{'dns_suffixes'}->[$i0]";
    }
    $encoded->{'override_dns'} = ($in->{'override_dns'}) ? JSON::true : JSON::false;
    $encoded->{'dns_ip_1'} = "$in->{'dns_ip_1'}";
    $encoded->{'dns_ip_2'} = "$in->{'dns_ip_2'}";
    $encoded->{'domain_name'} = "$in->{'domain_name'}";
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'enabled'} = ($in->{'enabled'}) ? 1 : 0;
    $decoded->{'autocfg'} = $in->{'autocfg'};
    $decoded->{'ipaddr'} = $in->{'ipaddr'};
    $decoded->{'gateway'} = $in->{'gateway'};
    $decoded->{'hostname'} = $in->{'hostname'};
    $decoded->{'dns_suffixes'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'dns_suffixes'}}; $i0++) {
        $decoded->{'dns_suffixes'}->[$i0] = $in->{'dns_suffixes'}->[$i0];
    }
    $decoded->{'override_dns'} = ($in->{'override_dns'}) ? 1 : 0;
    $decoded->{'dns_ip_1'} = $in->{'dns_ip_1'};
    $decoded->{'dns_ip_2'} = $in->{'dns_ip_2'};
    $decoded->{'domain_name'} = $in->{'domain_name'};
    return $decoded;
}

1;
