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

use strict;

package Raritan::RPC::cew::EnergyWiseSettings;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'enabled'} = ($in->{'enabled'}) ? JSON::true : JSON::false;
    $encoded->{'domainName'} = "$in->{'domainName'}";
    $encoded->{'secret'} = "$in->{'secret'}";
    $encoded->{'port'} = 1 * $in->{'port'};
    $encoded->{'pollingInterval'} = 1 * $in->{'pollingInterval'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'enabled'} = ($in->{'enabled'}) ? 1 : 0;
    $decoded->{'domainName'} = $in->{'domainName'};
    $decoded->{'secret'} = $in->{'secret'};
    $decoded->{'port'} = $in->{'port'};
    $decoded->{'pollingInterval'} = $in->{'pollingInterval'};
    return $decoded;
}

1;
