# 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::DoorAccessRuleChangedEvent;

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

sub encode {
    my ($in) = @_;
    my $encoded = Raritan::RPC::event::UserEvent::encode($in);
    $encoded->{'ruleId'} = 1 * $in->{'ruleId'};
    $encoded->{'oldRule'} = Raritan::RPC::smartlock::DoorAccessControl::DoorAccessRule::encode($in->{'oldRule'});
    $encoded->{'newRule'} = Raritan::RPC::smartlock::DoorAccessControl::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::DoorAccessRule::decode($agent, $in->{'oldRule'});
    $decoded->{'newRule'} = Raritan::RPC::smartlock::DoorAccessControl::DoorAccessRule::decode($agent, $in->{'newRule'});
    return $decoded;
}

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