# 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_0::CardCondition;

use Raritan::RPC::smartlock::DoorAccessControl_1_1_0::CardReaderInfo;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'enabled'} = ($in->{'enabled'}) ? JSON::true : JSON::false;
    $encoded->{'cardUid'} = "$in->{'cardUid'}";
    $encoded->{'cardReader'} = Raritan::RPC::smartlock::DoorAccessControl_1_1_0::CardReaderInfo::encode($in->{'cardReader'});
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'enabled'} = ($in->{'enabled'}) ? 1 : 0;
    $decoded->{'cardUid'} = $in->{'cardUid'};
    $decoded->{'cardReader'} = Raritan::RPC::smartlock::DoorAccessControl_1_1_0::CardReaderInfo::decode($agent, $in->{'cardReader'});
    return $decoded;
}

1;
