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

use strict;

package Raritan::RPC::sensors::NumericSensor_4_0_5::ThresholdCapabilities;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'hasUpperCritical'} = ($in->{'hasUpperCritical'}) ? JSON::true : JSON::false;
    $encoded->{'hasUpperWarning'} = ($in->{'hasUpperWarning'}) ? JSON::true : JSON::false;
    $encoded->{'hasLowerWarning'} = ($in->{'hasLowerWarning'}) ? JSON::true : JSON::false;
    $encoded->{'hasLowerCritical'} = ($in->{'hasLowerCritical'}) ? JSON::true : JSON::false;
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'hasUpperCritical'} = ($in->{'hasUpperCritical'}) ? 1 : 0;
    $decoded->{'hasUpperWarning'} = ($in->{'hasUpperWarning'}) ? 1 : 0;
    $decoded->{'hasLowerWarning'} = ($in->{'hasLowerWarning'}) ? 1 : 0;
    $decoded->{'hasLowerCritical'} = ($in->{'hasLowerCritical'}) ? 1 : 0;
    return $decoded;
}

1;
