package dev.lions.unionflow.client.service;

import dev.lions.unionflow.server.api.dto.backup.request.CreateBackupRequest;
import dev.lions.unionflow.server.api.dto.backup.request.RestoreBackupRequest;
import dev.lions.unionflow.server.api.dto.backup.request.UpdateBackupConfigRequest;
import dev.lions.unionflow.server.api.dto.backup.response.BackupConfigResponse;
import dev.lions.unionflow.server.api.dto.backup.response.BackupResponse;
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/backups")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface BackupService {

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

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

    @POST
    BackupResponse creerSauvegarde(CreateBackupRequest request);

    @POST
    @Path("/restore")
    BackupResponse restaurer(RestoreBackupRequest request);

    @DELETE
    @Path("/{id}")
    void supprimer(@PathParam("id") UUID id);

    @GET
    @Path("/config")
    BackupConfigResponse obtenirConfiguration();

    @PUT
    @Path("/config")
    BackupConfigResponse mettreAJourConfiguration(UpdateBackupConfigRequest request);

    @POST
    @Path("/restore-point")
    BackupResponse creerPointDeRestauration(CreateBackupRequest request);
}
