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

use strict;

package Raritan::RPC::smartlock::DoorAccessControl_1_1_1::DoorAccessRuleChangedEvent;

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

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_1::DoorAccessRule::encode($in->{'oldRule'});
    $encoded->{'newRule'} = Raritan::RPC::smartlock::DoorAccessControl_1_1_1::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_1::DoorAccessRule::decode($agent, $in->{'oldRule'});
    $decoded->{'newRule'} = Raritan::RPC::smartlock::DoorAccessControl_1_1_1::DoorAccessRule::decode($agent, $in->{'newRule'});
    return $decoded;
}

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