68 lines
3.1 KiB
TypeScript
68 lines
3.1 KiB
TypeScript
export type NationalityInfo = {
|
|
code: string;
|
|
country: string;
|
|
source: "udp" | "override";
|
|
};
|
|
|
|
const aiNationalityOverrides = new Map<string, Omit<NationalityInfo, "source">>([
|
|
["Stefano Pecchio", { code: "GBR", country: "United Kingdom" }],
|
|
["David Haggar", { code: "FRA", country: "France" }],
|
|
["Hans-Rolf Schade", { code: "DEU", country: "Germany" }],
|
|
["Martin Franek", { code: "JPN", country: "Japan" }],
|
|
["Martin G Webb", { code: "USA", country: "United States" }],
|
|
["Brook Murray", { code: "DEU", country: "Germany" }],
|
|
["Frank Lehmann", { code: "DEU", country: "Germany" }],
|
|
["Tony Rickard", { code: "GBR", country: "United Kingdom" }],
|
|
["Chris Rae", { code: "DEU", country: "Germany" }],
|
|
["Keith Brunnenkant", { code: "GBR", country: "United Kingdom" }],
|
|
["Jens Schmitt", { code: "USA", country: "United States" }],
|
|
["Andy Garton", { code: "USA", country: "United States" }],
|
|
["Rod Chong", { code: "USA", country: "United States" }],
|
|
["Vittorio Rapa", { code: "USA", country: "United States" }],
|
|
["Nathan Kammerud", { code: "USA", country: "United States" }],
|
|
["Peter Stuart", { code: "USA", country: "United States" }],
|
|
["Martin Webb", { code: "USA", country: "United States" }],
|
|
["Kay Schurig", { code: "USA", country: "United States" }],
|
|
["Xristo Papageorgas", { code: "USA", country: "United States" }],
|
|
["Graham Ritter", { code: "USA", country: "United States" }],
|
|
["Michael Steiner", { code: "DEU", country: "Germany" }],
|
|
["Victor Moraal", { code: "FRA", country: "France" }],
|
|
["Roucourt Rony", { code: "USA", country: "United States" }],
|
|
["Stefan Forster", { code: "DEU", country: "Germany" }],
|
|
["Kirk Kosinski", { code: "USA", country: "United States" }],
|
|
["Jon Large", { code: "FRA", country: "France" }],
|
|
["Sven Bender", { code: "DEU", country: "Germany" }],
|
|
["Gary Hunt", { code: "DEU", country: "Germany" }],
|
|
["Spencer McCarthy", { code: "USA", country: "United States" }],
|
|
["Chris Stenersen", { code: "DEU", country: "Germany" }],
|
|
["Kevin McKenzie", { code: "DEU", country: "Germany" }],
|
|
["Mark Turnbull", { code: "DEU", country: "Germany" }],
|
|
["Percy Veer", { code: "DEU", country: "Germany" }],
|
|
["Gareth Robinson", { code: "DEU", country: "Germany" }],
|
|
["Oliver Kaiser", { code: "DEU", country: "Germany" }],
|
|
["Gareth Harwood", { code: "DEU", country: "Germany" }],
|
|
["Rene Owara", { code: "DEU", country: "Germany" }],
|
|
["Holzer Rene", { code: "DEU", country: "Germany" }],
|
|
["Chrisi Schmidt", { code: "DEU", country: "Germany" }],
|
|
["John Atkinson", { code: "DEU", country: "Germany" }],
|
|
["Filipe Nunes", { code: "JPN", country: "Japan" }],
|
|
["INS3RT", { code: "DEU", country: "Germany" }]
|
|
]);
|
|
|
|
export function nationalityForDriver(name: unknown, udpNationality: unknown): NationalityInfo | undefined {
|
|
if (typeof udpNationality === "number" && udpNationality > 0) {
|
|
return {
|
|
code: String(udpNationality),
|
|
country: `UDP nationality ${udpNationality}`,
|
|
source: "udp"
|
|
};
|
|
}
|
|
|
|
if (typeof name !== "string") {
|
|
return undefined;
|
|
}
|
|
|
|
const override = aiNationalityOverrides.get(name);
|
|
return override ? { ...override, source: "override" } : undefined;
|
|
}
|