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

use strict;

package Raritan::RPC::logging::LogChunk;

use Raritan::RPC::logging::LogEntry;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'logCreationTime'} = 1 * $in->{'logCreationTime'};
    $encoded->{'idFirst'} = 1 * $in->{'idFirst'};
    $encoded->{'allEntryCnt'} = 1 * $in->{'allEntryCnt'};
    $encoded->{'selEntries'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'selEntries'}}; $i0++) {
        $encoded->{'selEntries'}->[$i0] = Raritan::RPC::logging::LogEntry::encode($in->{'selEntries'}->[$i0]);
    }
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'logCreationTime'} = $in->{'logCreationTime'};
    $decoded->{'idFirst'} = $in->{'idFirst'};
    $decoded->{'allEntryCnt'} = $in->{'allEntryCnt'};
    $decoded->{'selEntries'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'selEntries'}}; $i0++) {
        $decoded->{'selEntries'}->[$i0] = Raritan::RPC::logging::LogEntry::decode($agent, $in->{'selEntries'}->[$i0]);
    }
    return $decoded;
}

1;
