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

use strict;

package Raritan::RPC::event::AlarmManager::Alarm;

use Raritan::RPC::event::AlarmManager::Alert;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'id'} = "$in->{'id'}";
    $encoded->{'name'} = "$in->{'name'}";
    $encoded->{'actionId'} = "$in->{'actionId'}";
    $encoded->{'alerts'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'alerts'}}; $i0++) {
        $encoded->{'alerts'}->[$i0] = Raritan::RPC::event::AlarmManager::Alert::encode($in->{'alerts'}->[$i0]);
    }
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'id'} = $in->{'id'};
    $decoded->{'name'} = $in->{'name'};
    $decoded->{'actionId'} = $in->{'actionId'};
    $decoded->{'alerts'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'alerts'}}; $i0++) {
        $decoded->{'alerts'}->[$i0] = Raritan::RPC::event::AlarmManager::Alert::decode($agent, $in->{'alerts'}->[$i0]);
    }
    return $decoded;
}

1;
