package dev.lions.unionflow.client.service;

import dev.lions.unionflow.client.api.dto.RapportTrimestrielDto;
import dev.lions.unionflow.client.security.AuthHeaderFactory;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import java.util.List;
import java.util.UUID;
import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;

@RegisterRestClient(configKey = "unionflow-api")
@RegisterClientHeaders(AuthHeaderFactory.class)
@Path("/api/rapports/trimestriel")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface RapportTrimestrielRestClient {

  @GET
  List<RapportTrimestrielDto> lister(
      @QueryParam("orgId") UUID orgId,
      @QueryParam("annee") Integer annee);

  @POST
  @Path("/generer")
  RapportTrimestrielDto generer(
      @QueryParam("orgId") UUID orgId,
      @QueryParam("annee") int annee,
      @QueryParam("trimestre") int trimestre);

  @POST
  @Path("/{id}/signer")
  RapportTrimestrielDto signer(
      @PathParam("id") UUID id,
      @QueryParam("signataireId") UUID signataireId);

  @POST
  @Path("/{id}/archiver")
  RapportTrimestrielDto archiver(@PathParam("id") UUID id);

  @GET
  @Path("/{id}/pdf")
  @Produces("application/pdf")
  byte[] telechargerPdf(@PathParam("id") UUID id);
}
