115 lines
3.0 KiB
C#
115 lines
3.0 KiB
C#
namespace Core.Printing;
|
|
|
|
/// <summary>
|
|
/// Built-in merge token names. Imported student-note field names are supplied at runtime.
|
|
/// </summary>
|
|
public static class PrintFieldCatalog
|
|
{
|
|
public static readonly string[] Layout =
|
|
[
|
|
NoteTemplateMerger.PageBreakToken,
|
|
NoteTemplateMerger.AnswerSpaceToken,
|
|
NoteTemplateMerger.LegendToken
|
|
];
|
|
|
|
public static readonly string[] Chapter =
|
|
[
|
|
"Chapter.Name",
|
|
"Chapter.ShortName",
|
|
"Chapter.CompetitionYear",
|
|
"Chapter.YearlyTheme",
|
|
"Chapter.StateAbbrev"
|
|
];
|
|
|
|
public static readonly string[] Student =
|
|
[
|
|
"FirstName",
|
|
"LastName",
|
|
"Name",
|
|
"LastNameFirstName",
|
|
"Grade",
|
|
"TsaYear",
|
|
"Email",
|
|
"PhoneNumber",
|
|
"StateId",
|
|
"RegionalId",
|
|
"NationalId",
|
|
"OfficerRole"
|
|
];
|
|
|
|
/// <summary>
|
|
/// <c>Rank1</c>…<c>Rank10</c> and matching <c>.ShortName</c> tokens from
|
|
/// <see cref="StudentRankTokens"/>.
|
|
/// </summary>
|
|
public static readonly string[] StudentRanks = [.. StudentRankTokens.AllNames];
|
|
|
|
public static readonly string[] StudentRanks1To6 = [.. RankTokens(1, 6)];
|
|
|
|
public static readonly string[] StudentRanks7To10 = [.. RankTokens(7, 10)];
|
|
|
|
public static IReadOnlyList<string> RankTokens(int fromRank, int toRank) =>
|
|
[
|
|
.. Enumerable.Range(fromRank, toRank - fromRank + 1)
|
|
.SelectMany(rank => (string[])
|
|
[
|
|
StudentRankTokens.NameToken(rank),
|
|
StudentRankTokens.ShortNameToken(rank),
|
|
StudentRankTokens.AttributesToken(rank)
|
|
])
|
|
];
|
|
|
|
public static readonly string[] Team =
|
|
[
|
|
"Identifier",
|
|
"Name",
|
|
"EventName",
|
|
"EventShortName",
|
|
"EventFormat",
|
|
"TeamSize",
|
|
"NationalEligibility",
|
|
"Eligibility",
|
|
"RegionalTeamCount",
|
|
"StateTeamCount",
|
|
"Description",
|
|
"Theme",
|
|
"EventAttributes"
|
|
];
|
|
|
|
public static readonly string[] Event =
|
|
[
|
|
"Name",
|
|
"ShortName",
|
|
"EventFormat",
|
|
"TeamSize",
|
|
"NationalEligibility",
|
|
"Eligibility",
|
|
"RegionalTeamCount",
|
|
"StateTeamCount",
|
|
"LevelOfEffort",
|
|
"SemifinalistActivity",
|
|
"RegionalEvent",
|
|
"Description",
|
|
"Theme",
|
|
"Documentation",
|
|
"Notes",
|
|
"EventAttributes",
|
|
NoteTemplateMerger.RankedStudentsToken
|
|
];
|
|
|
|
public static IReadOnlyList<string> EntityTokens(PrintEntityType entityType) =>
|
|
entityType switch
|
|
{
|
|
PrintEntityType.Student => Student,
|
|
PrintEntityType.Team => Team,
|
|
PrintEntityType.Event => Event,
|
|
_ => []
|
|
};
|
|
|
|
public static IReadOnlyList<string> BuiltInFor(PrintEntityType entityType) =>
|
|
entityType switch
|
|
{
|
|
PrintEntityType.Student => [.. Chapter, .. Student, .. StudentRanks],
|
|
_ => [.. Chapter, .. EntityTokens(entityType)]
|
|
};
|
|
}
|