from lnx.logicnode.lnx_nodes import *


class OnTapScreen(LnxLogicTreeNode):
    """Activates the output on tap screen event.

    @input Duration: touching time
    @input Interval: interval between taps
    @input Repeat: repetitions amount to validate

    @output Done: the sequence success
    @output Fail: the the sequence failure
    @output Tap Number: number of the last tap
    @output Coords: the coordinates of the last tap
    """
    bl_idname = 'LNOnTapScreen'
    bl_label = 'On Tap Screen'
    lnx_section = 'Input'
    lnx_version = 1

    def lnx_init(self, context):
        self.add_input('LnxFloatSocket', 'Duration', default_value=0.3)
        self.add_input('LnxFloatSocket', 'Interval', default_value=0.0)
        self.add_input('LnxIntSocket', 'Repeat', default_value=2)

        self.add_output('LnxNodeSocketAction', 'Done')
        self.add_output('LnxNodeSocketAction', 'Fail')
        self.add_output('LnxNodeSocketAction', 'Tap')
        self.add_output('LnxIntSocket', 'Tap Number')
        self.add_output('LnxVectorSocket', 'Coords')