from .utils import str_list


class SignalFunctionType(object):
    def __init__(self, type_name, signal_inputs, signal_outputs):
        self.type_name = type_name

        self.signal_inputs = set(signal_inputs)
        self.signal_inputs_multiple = set(s for s in signal_inputs if SignalFunctionType.is_signal_list(s))

        self.signal_outputs = set(signal_outputs)
        self.signal_outputs_mutiple = set(s for s in signal_outputs if SignalFunctionType.is_signal_list(s))

    @staticmethod
    def is_signal_list(signal_name):
        return signal_name[0] == "*"

    @staticmethod
    def get_multi_signal_name(signal_name):
        return signal_name[1:]

    @staticmethod
    def make_multi_signal_name(signal_name):
        return "*" + signal_name

    def __repr__(self):
        return "%s :: %s => %s" % (self.type_name, str_list(self.signal_inputs), str_list(self.signal_outputs))


def SignalList(list):
    pass
