package com.nhn.example.match;

import com.nhn.example.game.GameRoom;
import com.nhn.gameanvil.game.GameAnvilUserMatchMaker;
import com.nhn.gameanvil.node.match.AbstractUserMatchMaker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

@GameAnvilUserMatchMaker(loadClass = GameRoom.class)
public class UserMatchMaker extends AbstractUserMatchMaker<UserMatchInfo> {

    private static final Logger log = LoggerFactory.getLogger(UserMatchMaker.class);

    public UserMatchMaker() {
        super(2, 5000);
    }

    private int matchSize = 2;

    @Override
    public void onMatch() {
        log.info("UserMatchMaker::onMatch()");
        List<UserMatchInfo> matchRequests = getMatchRequests(matchSize);

        if (matchRequests == null) {
            return;
        }

        int matchingAmount = matchSingles(matchRequests);
        log.info("matchingAmount:{}", matchingAmount);
    }

    @Override
    public boolean onRefill(UserMatchInfo matchReq) {
        return false;
    }
}
