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

use strict;

package Raritan::RPC::pdumodel::Pdu_5_1_2::OutletSequenceState;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'sequenceRunning'} = ($in->{'sequenceRunning'}) ? JSON::true : JSON::false;
    $encoded->{'nextOutletToSwitch'} = 1 * $in->{'nextOutletToSwitch'};
    $encoded->{'timeUntilNextSwitch'} = 1 * $in->{'timeUntilNextSwitch'};
    $encoded->{'outletsRemaining'} = 1 * $in->{'outletsRemaining'};
    $encoded->{'cancelableOutletsRemaining'} = 1 * $in->{'cancelableOutletsRemaining'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'sequenceRunning'} = ($in->{'sequenceRunning'}) ? 1 : 0;
    $decoded->{'nextOutletToSwitch'} = $in->{'nextOutletToSwitch'};
    $decoded->{'timeUntilNextSwitch'} = $in->{'timeUntilNextSwitch'};
    $decoded->{'outletsRemaining'} = $in->{'outletsRemaining'};
    $decoded->{'cancelableOutletsRemaining'} = $in->{'cancelableOutletsRemaining'};
    return $decoded;
}

1;
