from abc import (
    ABC,
    abstractmethod,
)
from typing import (
    Optional,
    Sequence,
)

from ._Registration import Registration


class RegistrationRepository(ABC):
    @abstractmethod
    def add_registration(self, registration: Registration):
        raise NotImplementedError()

    @abstractmethod
    def lookup(self, service_name: str) -> Optional[str]:
        raise NotImplementedError()

    @abstractmethod
    def keep_alive(self, reg_id: str):
        raise NotImplementedError()

    @abstractmethod
    def clean_registrations(self):
        raise NotImplementedError()

    @abstractmethod
    def get_all_registrations(self) -> Sequence[Registration]:
        raise NotImplementedError()

    @abstractmethod
    def get_registered_services(self) -> Sequence[str]:
        raise NotImplementedError()
