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

use strict;

package Raritan::RPC::sensors::NumericSensor_4_0_5::MinMax;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'minReading'} = 1 * $in->{'minReading'};
    $encoded->{'minReadingTimestamp'} = 1 * $in->{'minReadingTimestamp'};
    $encoded->{'maxReading'} = 1 * $in->{'maxReading'};
    $encoded->{'maxReadingTimestamp'} = 1 * $in->{'maxReadingTimestamp'};
    $encoded->{'valid'} = ($in->{'valid'}) ? JSON::true : JSON::false;
    $encoded->{'observedSince'} = 1 * $in->{'observedSince'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'minReading'} = $in->{'minReading'};
    $decoded->{'minReadingTimestamp'} = $in->{'minReadingTimestamp'};
    $decoded->{'maxReading'} = $in->{'maxReading'};
    $decoded->{'maxReadingTimestamp'} = $in->{'maxReadingTimestamp'};
    $decoded->{'valid'} = ($in->{'valid'}) ? 1 : 0;
    $decoded->{'observedSince'} = $in->{'observedSince'};
    return $decoded;
}

1;
