package de.fete.adapter.out.persistence;

import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;

/** Spring Data JPA repository for RSVP entities. */
public interface RsvpJpaRepository extends JpaRepository<RsvpJpaEntity, Long> {

  /** Finds an RSVP by its token. */
  java.util.Optional<RsvpJpaEntity> findByRsvpToken(UUID rsvpToken);

  /** Counts RSVPs for the given event. */
  long countByEventId(Long eventId);

  /** Finds all RSVPs for the given event, ordered by ID ascending. */
  java.util.List<RsvpJpaEntity> findAllByEventIdOrderByIdAsc(Long eventId);

  /** Deletes an RSVP by event ID and RSVP token. Returns count of deleted rows. */
  long deleteByEventIdAndRsvpToken(Long eventId, UUID rsvpToken);
}
