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

use strict;

package Raritan::RPC::peripheral::DeviceID_2_0_0;

use Raritan::RPC::sensors::Sensor_4_0_0::TypeSpec;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'serial'} = "$in->{'serial'}";
    $encoded->{'type'} = Raritan::RPC::sensors::Sensor_4_0_0::TypeSpec::encode($in->{'type'});
    $encoded->{'isActuator'} = ($in->{'isActuator'}) ? JSON::true : JSON::false;
    $encoded->{'channel'} = 1 * $in->{'channel'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'serial'} = $in->{'serial'};
    $decoded->{'type'} = Raritan::RPC::sensors::Sensor_4_0_0::TypeSpec::decode($agent, $in->{'type'});
    $decoded->{'isActuator'} = ($in->{'isActuator'}) ? 1 : 0;
    $decoded->{'channel'} = $in->{'channel'};
    return $decoded;
}

1;
