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

use strict;

package Raritan::RPC::datetime::DateTime::Cfg;

use Raritan::RPC::datetime::DateTime::NtpCfg;
use Raritan::RPC::datetime::DateTime::ZoneCfg;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'zoneCfg'} = Raritan::RPC::datetime::DateTime::ZoneCfg::encode($in->{'zoneCfg'});
    $encoded->{'protocol'} = $in->{'protocol'};
    $encoded->{'deviceTime'} = 1 * $in->{'deviceTime'};
    $encoded->{'ntpCfg'} = Raritan::RPC::datetime::DateTime::NtpCfg::encode($in->{'ntpCfg'});
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'zoneCfg'} = Raritan::RPC::datetime::DateTime::ZoneCfg::decode($agent, $in->{'zoneCfg'});
    $decoded->{'protocol'} = $in->{'protocol'};
    $decoded->{'deviceTime'} = $in->{'deviceTime'};
    $decoded->{'ntpCfg'} = Raritan::RPC::datetime::DateTime::NtpCfg::decode($agent, $in->{'ntpCfg'});
    return $decoded;
}

1;
