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

use strict;

package Raritan::RPC::smartlock::DoorAccessControl_1_1_0::DoorAccessRuleChangedEvent;

use constant typeId => "smartlock.DoorAccessControl_1_1_0.DoorAccessRuleChangedEvent:1.0.0";
use Raritan::RPC::event::UserEvent;
use Raritan::RPC::smartlock::DoorAccessControl_1_1_0::DoorAccessRule;
use Raritan::RPC::smartlock::DoorAccessControl_1_1_0::DoorAccessRule;

sub encode {
    my ($in) = @_;
    my $encoded = Raritan::RPC::event::UserEvent::encode($in);
    $encoded->{'ruleId'} = 1 * $in->{'ruleId'};
    $encoded->{'oldRule'} = Raritan::RPC::smartlock::DoorAccessControl_1_1_0::DoorAccessRule::encode($in->{'oldRule'});
    $encoded->{'newRule'} = Raritan::RPC::smartlock::DoorAccessControl_1_1_0::DoorAccessRule::encode($in->{'newRule'});
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = Raritan::RPC::event::UserEvent::decode($agent, $in);
    $decoded->{'ruleId'} = $in->{'ruleId'};
    $decoded->{'oldRule'} = Raritan::RPC::smartlock::DoorAccessControl_1_1_0::DoorAccessRule::decode($agent, $in->{'oldRule'});
    $decoded->{'newRule'} = Raritan::RPC::smartlock::DoorAccessControl_1_1_0::DoorAccessRule::decode($agent, $in->{'newRule'});
    return $decoded;
}

Raritan::RPC::Registry::registerCodecClass('smartlock.DoorAccessControl_1_1_0.DoorAccessRuleChangedEvent', 1, 0, 0, 'Raritan::RPC::smartlock::DoorAccessControl_1_1_0::DoorAccessRuleChangedEvent');
1;
