package de.cannamanage.service.repository;

import de.cannamanage.domain.entity.ForumReaction;
import de.cannamanage.domain.enums.ForumTargetType;
import de.cannamanage.domain.enums.ReactionType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

@Repository
public interface ForumReactionRepository extends JpaRepository<ForumReaction, UUID> {

    Optional<ForumReaction> findByTargetTypeAndTargetIdAndUserId(
            ForumTargetType targetType, UUID targetId, UUID userId);

    long countByTargetTypeAndTargetIdAndReactionType(
            ForumTargetType targetType, UUID targetId, ReactionType reactionType);

    List<ForumReaction> findByTargetTypeAndTargetId(ForumTargetType targetType, UUID targetId);

    void deleteByTargetTypeAndTargetId(ForumTargetType targetType, UUID targetId);
}
