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

use strict;

package Raritan::RPC::pdumodel::VoltageMonitoringSensor_1_0_1::DipSwellThresholds;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'dipActive'} = ($in->{'dipActive'}) ? JSON::true : JSON::false;
    $encoded->{'dipThreshold'} = 1 * $in->{'dipThreshold'};
    $encoded->{'swellActive'} = ($in->{'swellActive'}) ? JSON::true : JSON::false;
    $encoded->{'swellThreshold'} = 1 * $in->{'swellThreshold'};
    $encoded->{'deassertionHysteresis'} = 1 * $in->{'deassertionHysteresis'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'dipActive'} = ($in->{'dipActive'}) ? 1 : 0;
    $decoded->{'dipThreshold'} = $in->{'dipThreshold'};
    $decoded->{'swellActive'} = ($in->{'swellActive'}) ? 1 : 0;
    $decoded->{'swellThreshold'} = $in->{'swellThreshold'};
    $decoded->{'deassertionHysteresis'} = $in->{'deassertionHysteresis'};
    return $decoded;
}

1;
