"""Module for a base asteex test result."""

from abc import ABC, abstractmethod


class Result(ABC):
    """Class for a base test result."""

    @abstractmethod
    def get_instance(self):
        """Get the executed test instance.

        :returns: executed :class:`Instance <asteex.abstract.instance.Instance>`.
        """

    @abstractmethod
    def get_status(self):
        """Get the status of the test execution.

        :returns: string status.
        """

    @abstractmethod
    def get_reason(self):
        """Get the reason for the status.

        :returns: string reason.
        """

    @abstractmethod
    def get_case(self):
        """Get the executed case.

        :returns: executed :class:`Case <asteex.abstract.case.Case>` or None,
            if no case was retrieved.
        """

    @abstractmethod
    def get_context(self):
        """Get the execution context.

        :returns: dictionary with string names and arbitrary values, or None, if no context
            was created.
        """

    @abstractmethod
    def get_exception_information(self):
        """Get information about the exception raised during the execution.

        :returns: a tuple (type, value, traceback) similar to one returned by :meth:`sys.exc_info`.
        """

    def __repr__(self):
        class_name = self.__class__.__name__
        instance = self.get_instance()
        status = self.get_status()

        return f"{class_name}(instance={instance}, status='{status}')"
