# Path: applitools/core/errors.py
# class EyesError(Exception):
#     """
#     Applitools Eyes Exception.
#     """


import typing as tp
from collections import OrderedDict
from .errors import EyesError
    from .geometry import Point, Region
    # Required is required in order for jsonpickle to work on this object.
    # noinspection PyMethodMayBeStatic
    def __setstate__(self, state):
        raise EyesError('Cannot create MouseTrigger instance from dict!')

    def __str__(self):
        return "%s [%s] %s" % (self.action, self.control, self.location)


class TextTrigger(object):
    """Encapsulates a text input by the user."""

    def __init__(self, control, text):
        # type: (Region, tp.Text) -> None
        """
        Ctor.

        :param control: The region to which the text was entered.
        :param text: The trigger's text.
        """
        self.control = control
        self.text = text

    def __getstate__(self):
        return OrderedDict([(_TRIGGER_TYPE_FIELD_NAME, _TRIGGER_TYPE['text']),
                            ("control", self.control), ("text", self.text)])

    # Required is required in order for jsonpickle to work on this object.
    # noinspection PyMethodMayBeStatic
    def __setstate__(self, state):

# Path: applitools/core/errors.py
# class EyesError(Exception):
#     """
#     Applitools Eyes Exception.
#     """


# Path: applitools/core/triggers.py
import typing as tp
from collections import OrderedDict
from .errors import EyesError
    from .geometry import Point, Region

    # Required is required in order for jsonpickle to work on this object.
    # noinspection PyMethodMayBeStatic
    def __setstate__(self, state):
        raise EyesError('Cannot create MouseTrigger instance from dict!')

    def __str__(self):
        return "%s [%s] %s" % (self.action, self.control, self.location)


class TextTrigger(object):
    """Encapsulates a text input by the user."""

    def __init__(self, control, text):
        # type: (Region, tp.Text) -> None
        """
        Ctor.

        :param control: The region to which the text was entered.
        :param text: The trigger's text.
        """
        self.control = control
        self.text = text

    def __getstate__(self):
        return OrderedDict([(_TRIGGER_TYPE_FIELD_NAME, _TRIGGER_TYPE['text']),
                            ("control", self.control), ("text", self.text)])

    # Required is required in order for jsonpickle to work on this object.
    # noinspection PyMethodMayBeStatic
    def __setstate__(self, state):

        raise EyesError('Cannot create MouseTrigger instance from dict!')