package like

import (
	"context"
	"tercul/internal/domain"
)

// LikeQueries contains the query handlers for the like aggregate.
type LikeQueries struct {
	repo domain.LikeRepository
}

// NewLikeQueries creates a new LikeQueries handler.
func NewLikeQueries(repo domain.LikeRepository) *LikeQueries {
	return &LikeQueries{repo: repo}
}

// Like returns a like by ID.
func (q *LikeQueries) Like(ctx context.Context, id uint) (*domain.Like, error) {
	return q.repo.GetByID(ctx, id)
}

// LikesByUserID returns all likes for a user.
func (q *LikeQueries) LikesByUserID(ctx context.Context, userID uint) ([]domain.Like, error) {
	return q.repo.ListByUserID(ctx, userID)
}

// LikesByWorkID returns all likes for a work.
func (q *LikeQueries) LikesByWorkID(ctx context.Context, workID uint) ([]domain.Like, error) {
	return q.repo.ListByWorkID(ctx, workID)
}

// LikesByTranslationID returns all likes for a translation.
func (q *LikeQueries) LikesByTranslationID(ctx context.Context, translationID uint) ([]domain.Like, error) {
	return q.repo.ListByTranslationID(ctx, translationID)
}

// LikesByCommentID returns all likes for a comment.
func (q *LikeQueries) LikesByCommentID(ctx context.Context, commentID uint) ([]domain.Like, error) {
	return q.repo.ListByCommentID(ctx, commentID)
}

// Likes returns all likes.
func (q *LikeQueries) Likes(ctx context.Context) ([]domain.Like, error) {
	return q.repo.ListAll(ctx)
}
