package dev.lions.unionflow.client.service;

import dev.lions.unionflow.server.api.dto.communication.request.CreateConversationRequest;
import dev.lions.unionflow.server.api.dto.communication.response.ConversationResponse;
import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;

import java.util.List;
import java.util.UUID;

@RegisterRestClient(configKey = "unionflow-api")
@RegisterClientHeaders(dev.lions.unionflow.client.security.AuthHeaderFactory.class)
@Path("/api/conversations")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface ConversationService {

    @GET
    List<ConversationResponse> listerConversations(
        @QueryParam("page") @DefaultValue("0") int page,
        @QueryParam("size") @DefaultValue("20") int size
    );

    @GET
    @Path("/{id}")
    ConversationResponse obtenirParId(@PathParam("id") UUID id);

    @POST
    ConversationResponse creer(CreateConversationRequest request);

    @PUT
    @Path("/{id}/archive")
    ConversationResponse archiver(
        @PathParam("id") UUID id,
        @QueryParam("archive") @DefaultValue("true") boolean archive
    );

    @PUT
    @Path("/{id}/mark-read")
    void marquerCommeLue(@PathParam("id") UUID id);

    @PUT
    @Path("/{id}/toggle-mute")
    ConversationResponse basculerSilence(@PathParam("id") UUID id);

    @PUT
    @Path("/{id}/toggle-pin")
    ConversationResponse basculerEpinglage(@PathParam("id") UUID id);
}
