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

use strict;

package Raritan::RPC::pdumodel::Unit_1_0_1::DisplayInfo;

use Raritan::RPC::pdumodel::Unit_1_0_1::DisplayOptions;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'type'} = "$in->{'type'}";
    $encoded->{'address'} = "$in->{'address'}";
    $encoded->{'options'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'options'}}; $i0++) {
        $encoded->{'options'}->[$i0] = Raritan::RPC::pdumodel::Unit_1_0_1::DisplayOptions::encode($in->{'options'}->[$i0]);
    }
    $encoded->{'orientation'} = $in->{'orientation'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'type'} = $in->{'type'};
    $decoded->{'address'} = $in->{'address'};
    $decoded->{'options'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'options'}}; $i0++) {
        $decoded->{'options'}->[$i0] = Raritan::RPC::pdumodel::Unit_1_0_1::DisplayOptions::decode($agent, $in->{'options'}->[$i0]);
    }
    $decoded->{'orientation'} = $in->{'orientation'};
    return $decoded;
}

1;
