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

use Raritan::RPC::net::IpAddrCidr;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'enabled'} = ($in->{'enabled'}) ? JSON::true : JSON::false;
    $encoded->{'configMethod'} = 1 * $in->{'configMethod'};
    $encoded->{'addrsCidr'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'addrsCidr'}}; $i0++) {
        $encoded->{'addrsCidr'}->[$i0] = Raritan::RPC::net::IpAddrCidr::encode($in->{'addrsCidr'}->[$i0]);
    }
    $encoded->{'dhcpServerId'} = "$in->{'dhcpServerId'}";
    $encoded->{'dhcpPreferredHostname'} = "$in->{'dhcpPreferredHostname'}";
    $encoded->{'raManaged'} = ($in->{'raManaged'}) ? JSON::true : JSON::false;
    $encoded->{'raOtherConf'} = ($in->{'raOtherConf'}) ? JSON::true : JSON::false;
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'enabled'} = ($in->{'enabled'}) ? 1 : 0;
    $decoded->{'configMethod'} = $in->{'configMethod'};
    $decoded->{'addrsCidr'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'addrsCidr'}}; $i0++) {
        $decoded->{'addrsCidr'}->[$i0] = Raritan::RPC::net::IpAddrCidr::decode($agent, $in->{'addrsCidr'}->[$i0]);
    }
    $decoded->{'dhcpServerId'} = $in->{'dhcpServerId'};
    $decoded->{'dhcpPreferredHostname'} = $in->{'dhcpPreferredHostname'};
    $decoded->{'raManaged'} = ($in->{'raManaged'}) ? 1 : 0;
    $decoded->{'raOtherConf'} = ($in->{'raOtherConf'}) ? 1 : 0;
    return $decoded;
}

1;
