package dev.dinauer.maven;

import dev.dinauer.maven.maven.core.Service;
import io.quarkus.arc.profile.IfBuildProfile;
import io.quarkus.runtime.Startup;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

@jakarta.ws.rs.Path("/dev")
@IfBuildProfile("dev")
public class Dev
{
    @Inject
    Service service;

    @GET
    public void init() throws IOException
    {
        service.upload("/org/postgresql/postgresql/41.4.9/postgresql-41.4.9.jar", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/src/main/resources/jar/postgresql-42.7.9.jar"))).close();
        service.upload("/org/postgresql/postgresql/41.4.9/postgresql-41.4.9.pom", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/src/main/resources/jar/postgresql-42.7.9.pom"))).close();

        service.upload("/com/fasterxml/jackson/core/jackson-core/2.21.0/jackson-core-2.21.0.jar", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/src/main/resources/jar/jackson-core-2.21.0.jar"))).close();
        service.upload("/com/fasterxml/jackson/core/jackson-core/2.21.0/jackson-core-2.21.0.pom", Files.readAllBytes(Path.of("/home/andreas/Documents/dev/maven/core/src/main/resources/jar/jackson-core-2.21.0.pom"))).close();
    }
}