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

use strict;

package Raritan::RPC::pdumodel::MeteredLinePair_3_0_0;


sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'leftLine'} = 1 * $in->{'leftLine'};
    $encoded->{'rightLine'} = 1 * $in->{'rightLine'};
    $encoded->{'leftNodeId'} = 1 * $in->{'leftNodeId'};
    $encoded->{'rightNodeId'} = 1 * $in->{'rightNodeId'};
    $encoded->{'voltage'} = Raritan::RPC::ObjectCodec::encode($in->{'voltage'});
    $encoded->{'current'} = Raritan::RPC::ObjectCodec::encode($in->{'current'});
    $encoded->{'peakCurrent'} = Raritan::RPC::ObjectCodec::encode($in->{'peakCurrent'});
    $encoded->{'activePower'} = Raritan::RPC::ObjectCodec::encode($in->{'activePower'});
    $encoded->{'reactivePower'} = Raritan::RPC::ObjectCodec::encode($in->{'reactivePower'});
    $encoded->{'apparentPower'} = Raritan::RPC::ObjectCodec::encode($in->{'apparentPower'});
    $encoded->{'powerFactor'} = Raritan::RPC::ObjectCodec::encode($in->{'powerFactor'});
    $encoded->{'phaseAngle'} = Raritan::RPC::ObjectCodec::encode($in->{'phaseAngle'});
    $encoded->{'displacementPowerFactor'} = Raritan::RPC::ObjectCodec::encode($in->{'displacementPowerFactor'});
    $encoded->{'activeEnergy'} = Raritan::RPC::ObjectCodec::encode($in->{'activeEnergy'});
    $encoded->{'apparentEnergy'} = Raritan::RPC::ObjectCodec::encode($in->{'apparentEnergy'});
    $encoded->{'crestFactor'} = Raritan::RPC::ObjectCodec::encode($in->{'crestFactor'});
    $encoded->{'voltageThd'} = Raritan::RPC::ObjectCodec::encode($in->{'voltageThd'});
    $encoded->{'currentThd'} = Raritan::RPC::ObjectCodec::encode($in->{'currentThd'});
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'leftLine'} = $in->{'leftLine'};
    $decoded->{'rightLine'} = $in->{'rightLine'};
    $decoded->{'leftNodeId'} = $in->{'leftNodeId'};
    $decoded->{'rightNodeId'} = $in->{'rightNodeId'};
    $decoded->{'voltage'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'voltage'}, 'sensors.NumericSensor');
    $decoded->{'current'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'current'}, 'sensors.NumericSensor');
    $decoded->{'peakCurrent'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'peakCurrent'}, 'sensors.NumericSensor');
    $decoded->{'activePower'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'activePower'}, 'sensors.NumericSensor');
    $decoded->{'reactivePower'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'reactivePower'}, 'sensors.NumericSensor');
    $decoded->{'apparentPower'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'apparentPower'}, 'sensors.NumericSensor');
    $decoded->{'powerFactor'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'powerFactor'}, 'sensors.NumericSensor');
    $decoded->{'phaseAngle'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'phaseAngle'}, 'sensors.NumericSensor');
    $decoded->{'displacementPowerFactor'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'displacementPowerFactor'}, 'sensors.NumericSensor');
    $decoded->{'activeEnergy'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'activeEnergy'}, 'sensors.NumericSensor');
    $decoded->{'apparentEnergy'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'apparentEnergy'}, 'sensors.NumericSensor');
    $decoded->{'crestFactor'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'crestFactor'}, 'sensors.NumericSensor');
    $decoded->{'voltageThd'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'voltageThd'}, 'sensors.NumericSensor');
    $decoded->{'currentThd'} = Raritan::RPC::ObjectCodec::decode($agent, $in->{'currentThd'}, 'sensors.NumericSensor');
    return $decoded;
}

1;
