package com.pandoli365.bibimbap.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface JamScoreStatsMapper {

    @Select("""
            SELECT
                game_id          AS "gameId",
                weighted_total   AS "weightedTotal",
                simple_total     AS "simpleTotal",
                scored_criteria  AS "scoredCriteria",
                judge_count      AS "judgeCount"
            FROM jam_score_stats
            WHERE jam_id = #{jamId}
            ORDER BY weighted_total DESC NULLS LAST, judge_count DESC, game_id ASC
            """)
    List<Map<String, Object>> listStatsByJam(long jamId);
}
