package fr.titionfire.ffsaf.rest;

import fr.titionfire.ffsaf.domain.service.ResultService;
import fr.titionfire.ffsaf.rest.data.ResultCategoryData;
import fr.titionfire.ffsaf.utils.SecurityCtx;
import io.quarkus.security.Authenticated;
import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;

import java.util.List;

@Authenticated
@Path("api/result")
public class ResultEndpoints {

    @Inject
    ResultService resultService;

    @Inject
    SecurityCtx securityCtx;

    @GET
    @Path("list")
    public Uni<List<Object[]>> getList() {
        return resultService.getList(securityCtx);
    }

    @GET
    @Path("{uuid}")
    public Uni<List<ResultCategoryData>> getCategory(@PathParam("uuid") String uuid) {
        return resultService.getCategory(uuid, securityCtx);
    }

    @GET
    @Path("{uuid}/club")
    public Uni<ResultService.ClubArrayData> getClub(@PathParam("uuid") String uuid) {
        return resultService.getClubArray(uuid, securityCtx);
    }

    @GET
    @Path("{uuid}/comb")
    public Uni<ResultService.CombsArrayData> getComb(@PathParam("uuid") String uuid) {
        return resultService.getAllCombArray(uuid, securityCtx);
    }
}
