using System; using Pinwheel.Extensions; namespace Pinwheel.Reporting { public class AwardSummary { private readonly Type awardType; private readonly int totalAwards; private readonly double? totalScore; protected internal Type AwardType { get { return awardType; } } public virtual string ID { get { return awardType.AssemblyQualifiedName; } } public virtual int Count { get { return totalAwards; } } public virtual string Description { get { return awardType.GetDescriptionFromAttribute(); } } public virtual string Name { get { return awardType.GetNameFromAttribute(); } } public virtual bool HasScore { get { return totalScore.HasValue; } } public virtual double TotalScore { get { return HasScore ? totalScore.Value : default(double); } } public AwardSummary(Type awardType, int totalAwards, double? totalScore) { this.awardType = awardType; this.totalAwards = totalAwards; this.totalScore = totalScore; } } public class AwardSummary : AwardSummary where T : Award { public AwardSummary(int totalAwards, double? totalScore) : base(typeof(T), totalAwards, totalScore) { } } }