// Path: src/main/java/pl/setblack/pongi/scores/ScoreRecord.java
// @Immutable
// public class ScoreRecord {
//     public final String userId;
//     public final GameResult result;
//     public final int playerScored;
//     public final int opponentScore;
//     public final String gameId;
// 
//     public ScoreRecord(
//             String userId,
//             GameResult result,
//             int playerScore,
//             int opponentScore,
//             String gameId) {
//         this.userId = userId;
//         this.result = result;
//         this.playerScored = playerScore;
//         this.opponentScore = opponentScore;
//         this.gameId = gameId;
//     }
// }
// 
// Path: src/main/java/pl/setblack/pongi/scores/UserScore.java
// @JsonDeserialize
// @Immutable
// public class UserScore implements Serializable {
//     private static final long serialVersionUID = 1L;
//     public final String userId;
//     public final int totalScore;
//     public final int gamesWon;
//     public final int gamesLost;
//     public final int gamesPlayed;
//     public final int pointsScored;
//     public final int pointsLost;
// 
//     @JsonCreator
//     public UserScore(String userId, int totalScore, int gamesWon, int gamesLost, int gamesPlayed, int pointsScored, int pointsLost) {
//         this.userId = userId;
//         this.totalScore = totalScore;
//         this.gamesWon = gamesWon;
//         this.gamesLost = gamesLost;
//         this.gamesPlayed = gamesPlayed;
//         this.pointsScored = pointsScored;
//         this.pointsLost = pointsLost;
//     }
// 
//     public static UserScore emptyFor(String userId) {
//         return new UserScore(
//                 userId,
//                 0,
//                 0,
//                 0,
//                 0,
//                 0,
//                 0);
//     }
// 
//     public UserScore add(ScoreRecord rec) {
//         final int newScore = this.totalScore + rec.result.score;
//         final int newWon = this.gamesWon +
//                 (rec.result == GameResult.WON ? 1 : 0);
//         final int newLost = this.gamesLost +
//                 (rec.result == GameResult.LOST ? 1 : 0);
//         final int newPlayed = this.gamesPlayed + 1;
//         final int newPointsScored = this.pointsScored + rec.playerScored;
//         final int newPointsLost = this.pointsLost + rec.opponentScore;
//         return new UserScore(
//                 this.userId,
//                 newScore,
//                 newWon,
//                 newLost,
//                 newPlayed,
//                 newPointsScored,
//                 newPointsLost);
//     }
// }


import javaslang.collection.List;
import javaslang.control.Option;
import pl.setblack.pongi.scores.ScoreRecord;
import pl.setblack.pongi.scores.UserScore;
package pl.setblack.pongi.scores.repo;


/**
 * Created by jarek on 2/5/17.
 */
public interface ScoresRepository {

    void registerScore(List<ScoreRecord> rec);

    Option<UserScore> getUserScore(String userId);

// Path: src/main/java/pl/setblack/pongi/scores/ScoreRecord.java
// @Immutable
// public class ScoreRecord {
//     public final String userId;
//     public final GameResult result;
//     public final int playerScored;
//     public final int opponentScore;
//     public final String gameId;
// 
//     public ScoreRecord(
//             String userId,
//             GameResult result,
//             int playerScore,
//             int opponentScore,
//             String gameId) {
//         this.userId = userId;
//         this.result = result;
//         this.playerScored = playerScore;
//         this.opponentScore = opponentScore;
//         this.gameId = gameId;
//     }
// }
// 
// Path: src/main/java/pl/setblack/pongi/scores/UserScore.java
// @JsonDeserialize
// @Immutable
// public class UserScore implements Serializable {
//     private static final long serialVersionUID = 1L;
//     public final String userId;
//     public final int totalScore;
//     public final int gamesWon;
//     public final int gamesLost;
//     public final int gamesPlayed;
//     public final int pointsScored;
//     public final int pointsLost;
// 
//     @JsonCreator
//     public UserScore(String userId, int totalScore, int gamesWon, int gamesLost, int gamesPlayed, int pointsScored, int pointsLost) {
//         this.userId = userId;
//         this.totalScore = totalScore;
//         this.gamesWon = gamesWon;
//         this.gamesLost = gamesLost;
//         this.gamesPlayed = gamesPlayed;
//         this.pointsScored = pointsScored;
//         this.pointsLost = pointsLost;
//     }
// 
//     public static UserScore emptyFor(String userId) {
//         return new UserScore(
//                 userId,
//                 0,
//                 0,
//                 0,
//                 0,
//                 0,
//                 0);
//     }
// 
//     public UserScore add(ScoreRecord rec) {
//         final int newScore = this.totalScore + rec.result.score;
//         final int newWon = this.gamesWon +
//                 (rec.result == GameResult.WON ? 1 : 0);
//         final int newLost = this.gamesLost +
//                 (rec.result == GameResult.LOST ? 1 : 0);
//         final int newPlayed = this.gamesPlayed + 1;
//         final int newPointsScored = this.pointsScored + rec.playerScored;
//         final int newPointsLost = this.pointsLost + rec.opponentScore;
//         return new UserScore(
//                 this.userId,
//                 newScore,
//                 newWon,
//                 newLost,
//                 newPlayed,
//                 newPointsScored,
//                 newPointsLost);
//     }
// }


// Path: src/main/java/pl/setblack/pongi/scores/repo/ScoresRepository.java
import javaslang.collection.List;
import javaslang.control.Option;
import pl.setblack.pongi.scores.ScoreRecord;
import pl.setblack.pongi.scores.UserScore;

package pl.setblack.pongi.scores.repo;


/**
 * Created by jarek on 2/5/17.
 */
public interface ScoresRepository {

    void registerScore(List<ScoreRecord> rec);

    Option<UserScore> getUserScore(String userId);

    List<UserScore> getTopScores(final int limit);