package de.fete.domain.port.out;

import de.fete.domain.model.Event;
import de.fete.domain.model.EventToken;
import java.util.Optional;

/** Outbound port for persisting and retrieving events. */
public interface EventRepository {

  /** Persists the given event and returns it with generated fields populated. */
  Event save(Event event);

  /** Finds an event by its public event token. */
  Optional<Event> findByEventToken(EventToken eventToken);

  /** Deletes all events whose expiry date is in the past. Returns the number of deleted events. */
  int deleteExpired();
}
