package com.telephoners.krakyournet.ctf.resources;

import com.telephoners.krakyournet.ctf.beans.User;
import com.telephoners.krakyournet.ctf.beans.tasks.Task;
import com.telephoners.krakyournet.ctf.repositories.Repository;
import io.dropwizard.auth.Auth;

import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.net.URISyntaxException;

@Singleton
@Path(value = "/task")
public class TaskResource
{
    private final Repository<Task> tasksRepository;

    @Inject
    public TaskResource(Repository<Task> tasksRepository)
    {
        this.tasksRepository = tasksRepository;
    }


    @Path("{task_level}/{path: .*}")
    @GET
    public Response getTaskGet(@Auth User user,
                               final @PathParam("task_level") int taskLevel,
                               final @PathParam("path") String path,
                               @Context ContainerRequestContext containerRequestContext) throws IOException, URISyntaxException
    {
        return null;
//        Task task = tasksRepository.getByLevel(taskLevel);
//        retrn task.getTaskResponse();
    }
}
