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

use strict;

package Raritan::RPC::bulkcfg::BulkConfiguration_1_0_1::FilterProfile;


sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'name'} = "$in->{'name'}";
    $encoded->{'description'} = "$in->{'description'}";
    $encoded->{'filterNameToTypeMap'} = [];
    foreach my $key0 (keys %{$in->{'filterNameToTypeMap'}}) {
        my $value0 = $in->{'filterNameToTypeMap'}->{$key0};
        my $elem0 = {};
        $elem0->{'key'} = "$key0";
        $elem0->{'value'} = 1 * $value0;
        push(@{$encoded->{'filterNameToTypeMap'}}, $elem0);
    }
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'name'} = $in->{'name'};
    $decoded->{'description'} = $in->{'description'};
    $decoded->{'filterNameToTypeMap'} = {};
    for (my $i0 = 0; $i0 <= $#{$in->{'filterNameToTypeMap'}}; $i0++) {
        my $key0 = $in->{'filterNameToTypeMap'}->[$i0]->{'key'};
        my $value0 = $in->{'filterNameToTypeMap'}->[$i0]->{'value'};
        $decoded->{'filterNameToTypeMap'}->{$key0} = $value0;
    }
    return $decoded;
}

1;
