from __future__ import annotations

from abc import abstractmethod
from types import TracebackType
from typing import Self

from abcreg import AnnotatedABC


class Plugin(AnnotatedABC):
	"""Load-scoped plugin base; enter on load and exit on unload."""

	@abstractmethod
	def __enter__(self) -> Self: ...

	@abstractmethod
	def __exit__(
		self,
		exc_type: type[BaseException] | None,
		exc_value: BaseException | None,
		traceback: TracebackType | None,
	) -> bool | None: ...