package dev.peerat.backend.routes.admins;

import java.util.regex.Matcher;

import dev.peerat.backend.model.Completion;
import dev.peerat.framework.Context;
import dev.peerat.framework.HttpReader;
import dev.peerat.framework.HttpWriter;
import dev.peerat.framework.Injection;
import dev.peerat.framework.Locker;
import dev.peerat.framework.Response;
import dev.peerat.framework.Route;

public class WebHookLeaderboard implements Response{
	
	private Locker<Completion> locker;
	
	public WebHookLeaderboard(@Injection("leaderboard") Locker<Completion> locker){
		this.locker = locker;
	}
	
	@Route(path = "^/admin/webhook/leaderboard/$", needLogin = true)
	public void exec(Matcher matcher, Context context, HttpReader reader, HttpWriter writer) throws Exception{
		locker.setValue(new Completion(0, 0));
		context.response(200);
	}

}
