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

use strict;

package Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::ConfigurationChangedEvent;

use constant typeId => "peripheral.GatewaySensorManager_2_0_1.ConfigurationChangedEvent:1.0.0";
use Raritan::RPC::idl::Event;
use Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::ConfigurationPackage;

sub encode {
    my ($in) = @_;
    my $encoded = Raritan::RPC::idl::Event::encode($in);
    $encoded->{'configuration'} = [];
    foreach my $key0 (keys %{$in->{'configuration'}}) {
        my $value0 = $in->{'configuration'}->{$key0};
        my $elem0 = {};
        $elem0->{'key'} = "$key0";
        $elem0->{'value'} = Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::ConfigurationPackage::encode($value0);
        push(@{$encoded->{'configuration'}}, $elem0);
    }
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = Raritan::RPC::idl::Event::decode($agent, $in);
    $decoded->{'configuration'} = {};
    for (my $i0 = 0; $i0 <= $#{$in->{'configuration'}}; $i0++) {
        my $key0 = $in->{'configuration'}->[$i0]->{'key'};
        my $value0 = Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::ConfigurationPackage::decode($agent, $in->{'configuration'}->[$i0]->{'value'});
        $decoded->{'configuration'}->{$key0} = $value0;
    }
    return $decoded;
}

Raritan::RPC::Registry::registerCodecClass('peripheral.GatewaySensorManager_2_0_1.ConfigurationChangedEvent', 1, 0, 0, 'Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::ConfigurationChangedEvent');
1;
