from abc import abstractmethod
from collections.abc import Sequence
from typing import Protocol

from template_project.application.resume.entity import (
    Resume,
    ResumeEducation,
    ResumeExperience,
    ResumeId,
    ResumePrediction,
    ResumeProject,
)
from template_project.application.user.entity import UserId


class ResumeDataGateway(Protocol):
    @abstractmethod
    async def load_by_resume_id(self, resume_id: ResumeId) -> Resume | None:
        raise NotImplementedError

    @abstractmethod
    async def list_by_user_id(self, user_id: UserId, limit: int, offset: int) -> Sequence[Resume]:
        raise NotImplementedError

    @abstractmethod
    async def list_latest_by_user_id(self, user_id: UserId, limit: int, offset: int) -> Sequence[Resume]:
        raise NotImplementedError

    @abstractmethod
    async def get_history(self, resume_id: ResumeId) -> Sequence[Resume]:
        raise NotImplementedError


class ResumePredictionDataGateway(Protocol):
    @abstractmethod
    async def load_by_resume_id(self, resume_id: ResumeId) -> ResumePrediction | None:
        raise NotImplementedError


class ResumeExperienceDataGateway(Protocol):
    @abstractmethod
    async def load_by_resume_id(self, resume_id: ResumeId) -> Sequence[ResumeExperience]:
        raise NotImplementedError


class ResumeEducationDataGateway(Protocol):
    @abstractmethod
    async def load_by_resume_id(self, resume_id: ResumeId) -> Sequence[ResumeEducation]:
        raise NotImplementedError


class ResumeProjectDataGateway(Protocol):
    @abstractmethod
    async def load_by_resume_id(self, resume_id: ResumeId) -> Sequence[ResumeProject]:
        raise NotImplementedError
