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

use strict;

package Raritan::RPC::pdumodel::Bcm::ChannelConfig;

use Raritan::RPC::pdumodel::Bcm::PhaseConfig;
use Raritan::RPC::pdumodel::Bcm::PhaseConfig;
use Raritan::RPC::pdumodel::Bcm::PhaseConfig;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'channel'} = 1 * $in->{'channel'};
    $encoded->{'label'} = "$in->{'label'}";
    $encoded->{'is3Phase'} = ($in->{'is3Phase'}) ? JSON::true : JSON::false;
    $encoded->{'lineA'} = Raritan::RPC::pdumodel::Bcm::PhaseConfig::encode($in->{'lineA'});
    $encoded->{'lineB'} = Raritan::RPC::pdumodel::Bcm::PhaseConfig::encode($in->{'lineB'});
    $encoded->{'lineC'} = Raritan::RPC::pdumodel::Bcm::PhaseConfig::encode($in->{'lineC'});
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'channel'} = $in->{'channel'};
    $decoded->{'label'} = $in->{'label'};
    $decoded->{'is3Phase'} = ($in->{'is3Phase'}) ? 1 : 0;
    $decoded->{'lineA'} = Raritan::RPC::pdumodel::Bcm::PhaseConfig::decode($agent, $in->{'lineA'});
    $decoded->{'lineB'} = Raritan::RPC::pdumodel::Bcm::PhaseConfig::decode($agent, $in->{'lineB'});
    $decoded->{'lineC'} = Raritan::RPC::pdumodel::Bcm::PhaseConfig::decode($agent, $in->{'lineC'});
    return $decoded;
}

1;
