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

use strict;

package Raritan::RPC::cert::ServerSSLCert_2_0_0::Info;

use Raritan::RPC::cert::ServerSSLCert_2_0_0::ReqInfo;
use Raritan::RPC::cert::ServerSSLCert_2_0_0::CertInfo;
use Raritan::RPC::cert::ServerSSLCert_2_0_0::CertInfo;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'havePendingReq'} = ($in->{'havePendingReq'}) ? JSON::true : JSON::false;
    $encoded->{'havePendingCert'} = ($in->{'havePendingCert'}) ? JSON::true : JSON::false;
    $encoded->{'pendingReqInfo'} = Raritan::RPC::cert::ServerSSLCert_2_0_0::ReqInfo::encode($in->{'pendingReqInfo'});
    $encoded->{'pendingCertInfo'} = Raritan::RPC::cert::ServerSSLCert_2_0_0::CertInfo::encode($in->{'pendingCertInfo'});
    $encoded->{'activeCertInfo'} = Raritan::RPC::cert::ServerSSLCert_2_0_0::CertInfo::encode($in->{'activeCertInfo'});
    $encoded->{'maxSignDays'} = 1 * $in->{'maxSignDays'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'havePendingReq'} = ($in->{'havePendingReq'}) ? 1 : 0;
    $decoded->{'havePendingCert'} = ($in->{'havePendingCert'}) ? 1 : 0;
    $decoded->{'pendingReqInfo'} = Raritan::RPC::cert::ServerSSLCert_2_0_0::ReqInfo::decode($agent, $in->{'pendingReqInfo'});
    $decoded->{'pendingCertInfo'} = Raritan::RPC::cert::ServerSSLCert_2_0_0::CertInfo::decode($agent, $in->{'pendingCertInfo'});
    $decoded->{'activeCertInfo'} = Raritan::RPC::cert::ServerSSLCert_2_0_0::CertInfo::decode($agent, $in->{'activeCertInfo'});
    $decoded->{'maxSignDays'} = $in->{'maxSignDays'};
    return $decoded;
}

1;
