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

use strict;

package Raritan::RPC::servermon::ServerMonitor_2_0_1::ServerSettings;

use Raritan::RPC::servermon::ServerMonitor_2_0_1::ServerPowerSettings;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'host'} = "$in->{'host'}";
    $encoded->{'enabled'} = ($in->{'enabled'}) ? JSON::true : JSON::false;
    $encoded->{'pingInterval'} = 1 * $in->{'pingInterval'};
    $encoded->{'retryInterval'} = 1 * $in->{'retryInterval'};
    $encoded->{'activationCount'} = 1 * $in->{'activationCount'};
    $encoded->{'failureCount'} = 1 * $in->{'failureCount'};
    $encoded->{'resumeDelay'} = 1 * $in->{'resumeDelay'};
    $encoded->{'resumeCount'} = 1 * $in->{'resumeCount'};
    $encoded->{'powerSettings'} = Raritan::RPC::servermon::ServerMonitor_2_0_1::ServerPowerSettings::encode($in->{'powerSettings'});
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'host'} = $in->{'host'};
    $decoded->{'enabled'} = ($in->{'enabled'}) ? 1 : 0;
    $decoded->{'pingInterval'} = $in->{'pingInterval'};
    $decoded->{'retryInterval'} = $in->{'retryInterval'};
    $decoded->{'activationCount'} = $in->{'activationCount'};
    $decoded->{'failureCount'} = $in->{'failureCount'};
    $decoded->{'resumeDelay'} = $in->{'resumeDelay'};
    $decoded->{'resumeCount'} = $in->{'resumeCount'};
    $decoded->{'powerSettings'} = Raritan::RPC::servermon::ServerMonitor_2_0_1::ServerPowerSettings::decode($agent, $in->{'powerSettings'});
    return $decoded;
}

1;
