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

use strict;

package Raritan::RPC::net::DnsSettings_2_0_0;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'serverAddrs'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'serverAddrs'}}; $i0++) {
        $encoded->{'serverAddrs'}->[$i0] = "$in->{'serverAddrs'}->[$i0]";
    }
    $encoded->{'searchSuffixes'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'searchSuffixes'}}; $i0++) {
        $encoded->{'searchSuffixes'}->[$i0] = "$in->{'searchSuffixes'}->[$i0]";
    }
    $encoded->{'resolverPrefersIPv6'} = ($in->{'resolverPrefersIPv6'}) ? JSON::true : JSON::false;
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'serverAddrs'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'serverAddrs'}}; $i0++) {
        $decoded->{'serverAddrs'}->[$i0] = $in->{'serverAddrs'}->[$i0];
    }
    $decoded->{'searchSuffixes'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'searchSuffixes'}}; $i0++) {
        $decoded->{'searchSuffixes'}->[$i0] = $in->{'searchSuffixes'}->[$i0];
    }
    $decoded->{'resolverPrefersIPv6'} = ($in->{'resolverPrefersIPv6'}) ? 1 : 0;
    return $decoded;
}

1;
