package notification import ( "context" "errors" ) var ErrDependencyUnavailable = errors.New("dependency unavailable") var ErrNotificationNotFound = errors.New("notification not found") type Service struct { repo *Repository } func NewService(repo *Repository) *Service { return &Service{repo: repo} } func (s *Service) List(ctx context.Context, userID uint64, page, pageSize int) (*PaginatedResult, error) { if s.repo == nil { return nil, ErrDependencyUnavailable } return s.repo.List(ctx, userID, page, pageSize) } func (s *Service) MarkRead(ctx context.Context, userID uint64, id uint64) error { if s.repo == nil { return ErrDependencyUnavailable } return s.repo.MarkRead(ctx, userID, id) } func (s *Service) UnreadCount(ctx context.Context, userID uint64) (*UnreadCountDTO, error) { if s.repo == nil { return nil, ErrDependencyUnavailable } count, err := s.repo.UnreadCount(ctx, userID) if err != nil { return nil, err } return &UnreadCountDTO{UnreadCount: count}, nil } func (s *Service) MarkAllRead(ctx context.Context, userID uint64) (int64, error) { if s.repo == nil { return 0, ErrDependencyUnavailable } return s.repo.MarkAllRead(ctx, userID) }