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

use strict;

package Raritan::RPC::usermgmt::RoleManager::Info;

use Raritan::RPC::usermgmt::RoleManager::PrivilegeDesc;
use Raritan::RPC::usermgmt::RoleManager::RoleAccount;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'privileges'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'privileges'}}; $i0++) {
        $encoded->{'privileges'}->[$i0] = Raritan::RPC::usermgmt::RoleManager::PrivilegeDesc::encode($in->{'privileges'}->[$i0]);
    }
    $encoded->{'roles'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'roles'}}; $i0++) {
        $encoded->{'roles'}->[$i0] = Raritan::RPC::usermgmt::RoleManager::RoleAccount::encode($in->{'roles'}->[$i0]);
    }
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'privileges'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'privileges'}}; $i0++) {
        $decoded->{'privileges'}->[$i0] = Raritan::RPC::usermgmt::RoleManager::PrivilegeDesc::decode($agent, $in->{'privileges'}->[$i0]);
    }
    $decoded->{'roles'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'roles'}}; $i0++) {
        $decoded->{'roles'}->[$i0] = Raritan::RPC::usermgmt::RoleManager::RoleAccount::decode($agent, $in->{'roles'}->[$i0]);
    }
    return $decoded;
}

1;
