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

from abc import ABC, abstractmethod


class InstanceError(Exception):
    """Exception class for errors raised by instances."""


class Instance(ABC):
    """Class for a asteex test instance."""

    @abstractmethod
    def get_id(self):
        """Get the unique identifier of the instance.

        :returns: string id.
        """

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

        :returns: :class:`Case <asteex.abstract.case.Case>`.
        """

    @abstractmethod
    def get_context_sources(self):
        """Get information about origins of the context values.

        :returns: dictionary with string names as keys and
            :class:`Source <asteex.abstract.context.Source>` as values.
        """

    def __repr__(self):
        class_name = self.__class__.__name__
        instance_id = self.get_id()

        return f"{class_name}(instance_id='{instance_id}')"
