package dev.dinauer.maven.event;

import dev.dinauer.maven.app.EnhancedResponse;
import dev.dinauer.maven.app.ResponseEnhancementService;
import dev.dinauer.maven.user.User;
import dev.dinauer.maven.event.repo.EventRepo;
import dev.dinauer.maven.user.UserClient;
import io.quarkus.panache.common.Sort;
import io.vertx.ext.web.RoutingContext;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.SecurityContext;
import org.eclipse.microprofile.rest.client.inject.RestClient;

import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Path("/events")
public class EventsResource
{
    @Inject
    EventRepo eventRepo;

    @Inject
    ResponseEnhancementService responseEnhancementService;

    @GET
    public EnhancedResponse get(RoutingContext context)
    {
        return responseEnhancementService.enhance(eventRepo.listAll(Sort.by("timestamp", Sort.Direction.Descending)));
    }
}
