package dev.lions.unionflow.client.service;

import dev.lions.unionflow.server.api.dto.admin.response.AuditLogResponse;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import java.util.Map;
import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

/**
 * Service REST client pour la gestion des logs d'audit
 *
 * @author UnionFlow Team
 * @version 1.0
 */
@RegisterRestClient(configKey = "unionflow-api")
@RegisterClientHeaders(dev.lions.unionflow.client.security.AuthHeaderFactory.class)
@Path("/api/audit")
public interface AuditService {
    
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    Map<String, Object> listerTous(
            @QueryParam("page") int page,
            @QueryParam("size") int size,
            @QueryParam("sortBy") String sortBy,
            @QueryParam("sortOrder") String sortOrder);
    
    @POST
    @Path("/rechercher")
    @Produces(MediaType.APPLICATION_JSON)
    Map<String, Object> rechercher(
            @QueryParam("dateDebut") String dateDebut,
            @QueryParam("dateFin") String dateFin,
            @QueryParam("typeAction") String typeAction,
            @QueryParam("severite") String severite,
            @QueryParam("utilisateur") String utilisateur,
            @QueryParam("module") String module,
            @QueryParam("ipAddress") String ipAddress,
            @QueryParam("page") int page,
            @QueryParam("size") int size);
    
    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    AuditLogResponse enregistrerLog(AuditLogResponse dto);
    
    @GET
    @Path("/statistiques")
    @Produces(MediaType.APPLICATION_JSON)
    Map<String, Object> getStatistiques();
}

