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

use strict;

package Raritan::RPC::cascading::CascadeManager::LinkUnitStatusChangedEvent;

use constant typeId => "cascading.CascadeManager.LinkUnitStatusChangedEvent:1.0.0";
use Raritan::RPC::idl::Event;

sub encode {
    my ($in) = @_;
    my $encoded = Raritan::RPC::idl::Event::encode($in);
    $encoded->{'linkId'} = 1 * $in->{'linkId'};
    $encoded->{'host'} = "$in->{'host'}";
    $encoded->{'oldStatus'} = $in->{'oldStatus'};
    $encoded->{'newStatus'} = $in->{'newStatus'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = Raritan::RPC::idl::Event::decode($agent, $in);
    $decoded->{'linkId'} = $in->{'linkId'};
    $decoded->{'host'} = $in->{'host'};
    $decoded->{'oldStatus'} = ($in->{'oldStatus'} < 5 ? $in->{'oldStatus'} : 0);
    $decoded->{'newStatus'} = ($in->{'newStatus'} < 5 ? $in->{'newStatus'} : 0);
    return $decoded;
}

Raritan::RPC::Registry::registerCodecClass('cascading.CascadeManager.LinkUnitStatusChangedEvent', 1, 0, 0, 'Raritan::RPC::cascading::CascadeManager::LinkUnitStatusChangedEvent');
1;
