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

use strict;

package Raritan::RPC::sensors::AlertedSensorManager_1_0_3::AlertedSensorsChangedEvent;

use constant typeId => "sensors.AlertedSensorManager_1_0_3.AlertedSensorsChangedEvent:1.0.0";
use Raritan::RPC::idl::Event;
use Raritan::RPC::sensors::AlertedSensorManager_1_0_3::SensorCounts;
use Raritan::RPC::sensors::AlertedSensorManager_1_0_3::SensorData;

sub encode {
    my ($in) = @_;
    my $encoded = Raritan::RPC::idl::Event::encode($in);
    $encoded->{'counts'} = Raritan::RPC::sensors::AlertedSensorManager_1_0_3::SensorCounts::encode($in->{'counts'});
    $encoded->{'changedSensors'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'changedSensors'}}; $i0++) {
        $encoded->{'changedSensors'}->[$i0] = Raritan::RPC::sensors::AlertedSensorManager_1_0_3::SensorData::encode($in->{'changedSensors'}->[$i0]);
    }
    $encoded->{'removedSensors'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'removedSensors'}}; $i0++) {
        $encoded->{'removedSensors'}->[$i0] = Raritan::RPC::ObjectCodec::encode($in->{'removedSensors'}->[$i0]);
    }
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = Raritan::RPC::idl::Event::decode($agent, $in);
    $decoded->{'counts'} = Raritan::RPC::sensors::AlertedSensorManager_1_0_3::SensorCounts::decode($agent, $in->{'counts'});
    $decoded->{'changedSensors'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'changedSensors'}}; $i0++) {
        $decoded->{'changedSensors'}->[$i0] = Raritan::RPC::sensors::AlertedSensorManager_1_0_3::SensorData::decode($agent, $in->{'changedSensors'}->[$i0]);
    }
    $decoded->{'removedSensors'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'removedSensors'}}; $i0++) {
        $decoded->{'removedSensors'}->[$i0] = Raritan::RPC::ObjectCodec::decode($agent, $in->{'removedSensors'}->[$i0], 'sensors.Sensor');
    }
    return $decoded;
}

Raritan::RPC::Registry::registerCodecClass('sensors.AlertedSensorManager_1_0_3.AlertedSensorsChangedEvent', 1, 0, 0, 'Raritan::RPC::sensors::AlertedSensorManager_1_0_3::AlertedSensorsChangedEvent');
1;
