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

use strict;

package Raritan::RPC::peripheral::GatewaySensorManager_3_0_0::NumericSensorClass;

use constant typeId => "peripheral.GatewaySensorManager_3_0_0.NumericSensorClass:1.0.0";
use Raritan::RPC::peripheral::GatewaySensorManager_3_0_0::SensorClass;
use Raritan::RPC::sensors::NumericSensor_4_0_8::Thresholds;
use Raritan::RPC::sensors::NumericSensor_4_0_8::MetaData;

sub encode {
    my ($in) = @_;
    my $encoded = Raritan::RPC::peripheral::GatewaySensorManager_3_0_0::SensorClass::encode($in);
    $encoded->{'metadata'} = Raritan::RPC::sensors::NumericSensor_4_0_8::MetaData::encode($in->{'metadata'});
    $encoded->{'defaultThresholds'} = Raritan::RPC::sensors::NumericSensor_4_0_8::Thresholds::encode($in->{'defaultThresholds'});
    $encoded->{'preferCommonThresholds'} = ($in->{'preferCommonThresholds'}) ? JSON::true : JSON::false;
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = Raritan::RPC::peripheral::GatewaySensorManager_3_0_0::SensorClass::decode($agent, $in);
    $decoded->{'metadata'} = Raritan::RPC::sensors::NumericSensor_4_0_8::MetaData::decode($agent, $in->{'metadata'});
    $decoded->{'defaultThresholds'} = Raritan::RPC::sensors::NumericSensor_4_0_8::Thresholds::decode($agent, $in->{'defaultThresholds'});
    $decoded->{'preferCommonThresholds'} = ($in->{'preferCommonThresholds'}) ? 1 : 0;
    return $decoded;
}

Raritan::RPC::Registry::registerCodecClass('peripheral.GatewaySensorManager_3_0_0.NumericSensorClass', 1, 0, 0, 'Raritan::RPC::peripheral::GatewaySensorManager_3_0_0::NumericSensorClass');
1;
