# 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::Info;

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

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::ReqInfo::encode($in->{'pendingReqInfo'});
    $encoded->{'pendingCertInfo'} = Raritan::RPC::cert::ServerSSLCert::CertInfo::encode($in->{'pendingCertInfo'});
    $encoded->{'activeCertInfo'} = Raritan::RPC::cert::ServerSSLCert::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::ReqInfo::decode($agent, $in->{'pendingReqInfo'});
    $decoded->{'pendingCertInfo'} = Raritan::RPC::cert::ServerSSLCert::CertInfo::decode($agent, $in->{'pendingCertInfo'});
    $decoded->{'activeCertInfo'} = Raritan::RPC::cert::ServerSSLCert::CertInfo::decode($agent, $in->{'activeCertInfo'});
    $decoded->{'maxSignDays'} = $in->{'maxSignDays'};
    return $decoded;
}

1;
