import bpy
from .animator_transition import AnimatorTransition

class SocketBase():
    compatible_sockets = []

    # reroute method
    ###########################
    @property
    def connected_socket(self):
        pass
    
    # Link valid
    def is_socket_compatible(self, other_socket):
        return other_socket.bl_idname == self.bl_idname or other_socket.bl_idname in self.compatible_sockets

    @property
    def ui_value(self):
        '''use for output ui display'''
        pass

    def set_value(self, value):
        pass
        
    def get_self_value(self):
        pass

    def get_value(self):
        pass


class MotionSocket(bpy.types.NodeSocket, SocketBase):
    bl_idname = 'MotionSocket'
    bl_label = 'Motion Socket'

    compatible_sockets = []
    socket_color = (0.5, 0.7, 0.2, 1)
    
    # default_value: bpy.props.PointerProperty(type=bpy.types.Action)
    # name = bpy.props.StringProperty(default='')

    def draw(self, context, layout, node, text):
        if self.identifier.startswith('input'):
            return
        layout.label(text=text)
        pass

    def draw_color(self, context, node):
        return self.socket_color


def register():
    bpy.utils.register_class(MotionSocket)

def unregister():
    bpy.utils.unregister_class(MotionSocket)
