schedule logic

This commit is contained in:
Marshal
2026-06-10 09:22:57 +00:00
parent 0335555892
commit 088295d81f
23 changed files with 1766 additions and 319 deletions

View File

@@ -16,3 +16,16 @@ export function wagonReadinessMatchesSchedule(
if (!required) return true;
return wagonReadiness === required;
}
/**
* Toggle a readiness value (IMPORT_READY ↔ EXPORT_READY). Used when a train
* reaches its destination: the asset has repositioned, so it is now ready for
* the opposite direction. Direction-agnostic so it handles round trips.
*/
export function flipReadiness(
readiness: WagonReadiness | string,
): WagonReadiness {
return readiness === WagonReadiness.ImportReady
? WagonReadiness.ExportReady
: WagonReadiness.ImportReady;
}