# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod

class Interface(object):
    __meta__ = ABCMeta


class IConsumer(Interface):
    """A consumer consumes steps in a stack to find an object.
    """

    @abstractmethod
    def __call__(self, obj, stack, lookup):
        """Returns a boolean meaning that some stack has been consumed,
        an object and the rest of unconsumed stack
        """


class IResource(Interface):
    pass


class IResponse(Interface):
    pass


class IResponseFactory(Interface):
    """When called, a Response instance is returned.
    """
    @abstractmethod
    def __call__(self):
        """Returns a Response instance."""


class ITraject(Interface):
    pass


class IInverse(Interface):
    """Marker interface to hook in inverse component in a traject."""


class IRoot(Interface):
    """Mark this object as the root.
    """


class ILookup(Interface):
    """Mark this model as an model that can change the lookup.
    """


class IApp(Interface):
    """An application."""
    # XXX fill in details


class IModelBase(Interface):
    """Mark this object as a base of a model.
    """


class IPath(Interface):
    """Get the path for a model."""


class ILink(Interface):
    """Get the hyperlink for a model."""


class IConfigAction(Interface):
    """A configuration item.
    """

    @abstractmethod
    def discriminator(self):
        """Returns an immutable that uniquely identifies this config.

        Used for configuration conflict detection.
        """

    @abstractmethod
    def prepare(self, obj):
        """Prepare action for configuration.

        obj - the object being registered
        """

    @abstractmethod
    def perform(self, obj):
        """Register whatever is being configured.

        obj - the object being registered
        """


class ConfigError(Exception):
    """Raised when configuration is bad
    """


class ResolveError(Exception):
    """Raised when path cannot be resolved
    """


class ModelError(ResolveError):
    """Raised when a model cannot be resolved
    """


class ResourceError(ResolveError):
    """Raised when a resource cannot be resolved
    """


class TrajectError(Exception):
    """Raised when path supplied to traject is not allowed.
    """


class LinkError(Exception):
    """Raised when a link cannot be made.
    """

# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod

class Interface(object):
    __meta__ = ABCMeta


# class IConsumer(Interface):
#     """A consumer consumes steps in a stack to find an object.
#     """

#     @abstractmethod
#     def __call__(self, obj, stack, lookup):
#         """Returns a boolean meaning that some stack has been consumed,
#         an object and the rest of unconsumed stack
#         """


class IRoot(Interface):
    """Mark this object as the root.
    """

class IApp(Interface):
    """An application."""
    # XXX fill in details


class IConfigAction(Interface):
    """A configuration item.
    """

    @abstractmethod
    def discriminator(self):
        """Returns an immutable that uniquely identifies this config.

        Used for configuration conflict detection.
        """

    @abstractmethod
    def prepare(self, obj):
        """Prepare action for configuration.

        obj - the object being registered
        """

    @abstractmethod
    def perform(self, obj):
        """Register whatever is being configured.

        obj - the object being registered
        """


class ConfigError(Exception):
    """Raised when configuration is bad
    """


class ResolveError(Exception):
    """Raised when path cannot be resolved
    """


class ModelError(ResolveError):
    """Raised when a model cannot be resolved
    """


class ResourceError(ResolveError):
    """Raised when a resource cannot be resolved
    """


class TrajectError(Exception):
    """Raised when path supplied to traject is not allowed.
    """


class LinkError(Exception):
    """Raised when a link cannot be made.
    """

Remove various now unused interfaces.