using System.Collections.Generic;
namespace LaDOSE.Entity
{
///
/// Aggregate over the persisted rows of one or more Events.
/// Not an entity: it is never mapped by EF, it is computed in memory by
/// StatisticsService and mapped to MatchStatsDTO by AutoMapper (same pattern as
/// ).
/// Property names must stay identical to the DTO's, the mapping is by convention.
///
public class MatchStats
{
/// How much of the requested scope actually has set data behind it.
public MatchCoverage Coverage { get; set; } = new MatchCoverage();
public List Players { get; set; } = new List();
public List HeadToHead { get; set; } = new List();
}
///
/// Set coverage is sparse: Challonge-imported events have no sets at all, and events
/// imported before SmashProvider.GetSets existed were never backfilled. These counters
/// let a caller say "12 of 40 brackets have match data" instead of implying completeness.
///
public class MatchCoverage
{
/// Requested event ids that actually exist.
public int Events { get; set; }
/// Tournaments (brackets) belonging to those events.
public int Brackets { get; set; }
/// Of those brackets, how many have at least one set row.
public int BracketsWithSets { get; set; }
/// Total set rows in scope, including the ones skipped as unusable.
public int Sets { get; set; }
/// Sets with a determinable winner (unequal scores, two distinct real players).
public int DecidedSets { get; set; }
}
public class PlayerMatchStats
{
public int PlayerId { get; set; }
/// Gamertag, falling back to Name, else "#<id>".
public string Player { get; set; }
/// Decided sets only. Always equals Wins + Losses.
public int Sets { get; set; }
public int Wins { get; set; }
public int Losses { get; set; }
public int GamesWon { get; set; }
public int GamesLost { get; set; }
}
///
/// One row per unordered pair of players with at least one decided set.
/// A is always the lower PlayerId so WinsA / WinsB are unambiguous.
///
public class HeadToHead
{
public int PlayerAId { get; set; }
public string PlayerA { get; set; }
public int PlayerBId { get; set; }
public string PlayerB { get; set; }
public int WinsA { get; set; }
public int WinsB { get; set; }
}
}