package dev.dinauer.maven.maven.core;

import com.fasterxml.jackson.core.JsonProcessingException;
import io.quarkus.security.Authenticated;
import jakarta.inject.Inject;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response;


@Path("/maven2")
@Authenticated
public class Resource
{
    @Inject
    Service service;

    @PUT
    @Path("/{path: .*}")
    public Response put(@PathParam("path") String path, byte[] body)
    {
        return service.upload(path, body);
    }

    @GET
    @Path("/{path: .*}")
    public Response get(@PathParam("path") String path) throws JsonProcessingException
    {
        return service.serve(path);
    }
}
