# 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_2_2::KeypadCondition;

use Raritan::RPC::smartlock::DoorAccessControl_1_2_2::KeypadInfo;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'enabled'} = ($in->{'enabled'}) ? JSON::true : JSON::false;
    $encoded->{'pin'} = "$in->{'pin'}";
    $encoded->{'keypad'} = Raritan::RPC::smartlock::DoorAccessControl_1_2_2::KeypadInfo::encode($in->{'keypad'});
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'enabled'} = ($in->{'enabled'}) ? 1 : 0;
    $decoded->{'pin'} = $in->{'pin'};
    $decoded->{'keypad'} = Raritan::RPC::smartlock::DoorAccessControl_1_2_2::KeypadInfo::decode($agent, $in->{'keypad'});
    return $decoded;
}

1;
