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

use strict;

package Raritan::RPC::event::TimerEventManager::Schedule;

use Raritan::RPC::event::TimerEventManager::Range;
use Raritan::RPC::event::TimerEventManager::Range;
use Raritan::RPC::event::TimerEventManager::Range;
use Raritan::RPC::event::TimerEventManager::Range;
use Raritan::RPC::event::TimerEventManager::Range;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'minute'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'minute'}}; $i0++) {
        $encoded->{'minute'}->[$i0] = Raritan::RPC::event::TimerEventManager::Range::encode($in->{'minute'}->[$i0]);
    }
    $encoded->{'hour'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'hour'}}; $i0++) {
        $encoded->{'hour'}->[$i0] = Raritan::RPC::event::TimerEventManager::Range::encode($in->{'hour'}->[$i0]);
    }
    $encoded->{'dayOfMonth'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'dayOfMonth'}}; $i0++) {
        $encoded->{'dayOfMonth'}->[$i0] = Raritan::RPC::event::TimerEventManager::Range::encode($in->{'dayOfMonth'}->[$i0]);
    }
    $encoded->{'month'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'month'}}; $i0++) {
        $encoded->{'month'}->[$i0] = Raritan::RPC::event::TimerEventManager::Range::encode($in->{'month'}->[$i0]);
    }
    $encoded->{'dayOfWeek'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'dayOfWeek'}}; $i0++) {
        $encoded->{'dayOfWeek'}->[$i0] = Raritan::RPC::event::TimerEventManager::Range::encode($in->{'dayOfWeek'}->[$i0]);
    }
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'minute'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'minute'}}; $i0++) {
        $decoded->{'minute'}->[$i0] = Raritan::RPC::event::TimerEventManager::Range::decode($agent, $in->{'minute'}->[$i0]);
    }
    $decoded->{'hour'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'hour'}}; $i0++) {
        $decoded->{'hour'}->[$i0] = Raritan::RPC::event::TimerEventManager::Range::decode($agent, $in->{'hour'}->[$i0]);
    }
    $decoded->{'dayOfMonth'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'dayOfMonth'}}; $i0++) {
        $decoded->{'dayOfMonth'}->[$i0] = Raritan::RPC::event::TimerEventManager::Range::decode($agent, $in->{'dayOfMonth'}->[$i0]);
    }
    $decoded->{'month'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'month'}}; $i0++) {
        $decoded->{'month'}->[$i0] = Raritan::RPC::event::TimerEventManager::Range::decode($agent, $in->{'month'}->[$i0]);
    }
    $decoded->{'dayOfWeek'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'dayOfWeek'}}; $i0++) {
        $decoded->{'dayOfWeek'}->[$i0] = Raritan::RPC::event::TimerEventManager::Range::decode($agent, $in->{'dayOfWeek'}->[$i0]);
    }
    return $decoded;
}

1;
