Adding exact reason why train is not available to users search results

This commit is contained in:
Muluhabt
2026-07-25 12:28:07 +03:00
parent 2a0fd9bda5
commit d175514f85
6 changed files with 485 additions and 71 deletions

View File

@@ -34,6 +34,34 @@ export enum ScheduleStatus {
Delayed = "DELAYED",
}
/**
* Why a /search leg (outbound or inbound) came back with zero bookable schedules.
* Priority order applied by the API when classifying: NoRoute > NoScheduleOnDate >
* Cancelled > PackageOnly > CheckinClosed > FullyBooked (see search.service.ts
* classifyEmptySearch). The frontend uses this to show a specific empty-state
* message instead of a generic "no trains available".
*/
export enum SearchEmptyReasonCode {
/** No route (in either direction) ever connects these two stations. */
NoRoute = "NO_ROUTE",
/** A route connects these stations, but no schedule lands on the requested date at all. */
NoScheduleOnDate = "NO_SCHEDULE_ON_DATE",
/** Every schedule for this pair on this date was cancelled. */
Cancelled = "CANCELLED",
/** Every schedule for this pair on this date is package-only (excluded from ticket search). */
PackageOnly = "PACKAGE_ONLY",
/** A bookable schedule exists, but its check-in cutoff has already passed for every option. */
CheckinClosed = "CHECKIN_CLOSED",
/** A bookable, still-open schedule exists but has no seats left for the requested party. */
FullyBooked = "FULLY_BOOKED",
}
export interface ISearchEmptyReason {
code: SearchEmptyReasonCode;
originStationName: string;
destinationStationName: string;
}
export enum PaymentStatus {
Pending = "PENDING",
Paid = "PAID",