from __future__ import annotations

from abc import ABC, abstractmethod

from graph.connections.query_result import QueryResult


class DbConnection(ABC):
    @abstractmethod
    def __enter__(self) -> DbConnection:
        pass

    @abstractmethod
    def __exit__(self, exception_type, exception_value, exception_traceback) -> None:
        pass

    @abstractmethod
    def open(self) -> None:
        pass

    @abstractmethod
    def close(self) -> None:
        pass

    @abstractmethod
    def execute(self, query: str, parameters: dict | None = None) -> QueryResult:
        pass
