package dev.lions.unionflow.client.service;

import dev.lions.unionflow.server.api.dto.paiement.WaveCheckoutSessionDTO;
import dev.lions.unionflow.server.api.dto.paiement.WaveBalanceDTO;
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.math.BigDecimal;
import java.util.Map;
import java.util.UUID;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;

/**
 * Service REST client pour l'intégration Wave Money
 *
 * @author UnionFlow Team
 * @version 1.0
 * @since 2025-01-17
 */
@RegisterRestClient(configKey = "unionflow-api")
@RegisterClientHeaders(dev.lions.unionflow.client.security.AuthHeaderFactory.class)
@Path("/api/wave")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface WaveService {

  @POST
  @Path("/checkout/sessions")
  WaveCheckoutSessionDTO creerSessionPaiement(
      @QueryParam("montant") BigDecimal montant,
      @QueryParam("devise") String devise,
      @QueryParam("successUrl") String successUrl,
      @QueryParam("errorUrl") String errorUrl,
      @QueryParam("reference") String referenceUnionFlow,
      @QueryParam("description") String description,
      @QueryParam("organisationId") UUID organisationId,
      @QueryParam("membreId") UUID membreId);

  @GET
  @Path("/checkout/sessions/{sessionId}")
  WaveCheckoutSessionDTO verifierStatutSession(@PathParam("sessionId") String sessionId);

  @GET
  @Path("/balance")
  WaveBalanceDTO consulterSolde();

  @GET
  @Path("/test")
  Map<String, Object> testerConnexion();
}

