# -*- coding:utf-8 -*-
"""
Function: get_cdev_channel.py moudle. This moudle mainly involves the
Querying the Enabling Status of the Character Device Channel for
Communication Between the uREST and iBMC function.
Copyright Information: xFusion Digital Technologies Co.,
 Ltd. All Rights Reserved © 2020-2021
"""
from scripts import common_function


def getcdevchannel_init(parser, parser_dict):
    """
    Function Description:initializing the Command for
    Querying the Enabling Status of the Character Device Channel for
    Communication Between the uREST and iBMC
    Parameter:parser object: action object
    parser_dict dict: dictionary format of subcommand and ArgumentParser
    """
    sub_parser = parser.add_parser('getcdevchannel',
                                   help='query the channel type or enable'
                                        ' status of the communication between'
                                        ' the uREST and iBMC')
    parser_dict['getcdevchannel'] = sub_parser

    return 'getcdevchannel'


def getcdevchannel(client, _):
    """
    Function Description:get cdev channel enable
    Parameter:client str:RedfishClient object
    Return Value:resp dict:redfish Redfish Interface Value
    """
    channel_type, channel_status, resp = common_function.get_channel_info(
        client)
    if channel_status is not None:
        print("%s: %s" % (
            common_function.CDEV_CHANNEL_ENABLED_KEY, channel_status))
    if channel_type is not None:
        print("%s: %s" % (common_function.CHANNEL_TYPE_KEY, channel_type))
    return resp
