import { Moment } from "moment"; import { Calendar } from "../file/Calendar"; import { CalendarDate } from "../file/CalendarDate"; export declare class ScheduleCalendar { readonly runsFrom: Moment; readonly runsTo: Moment; readonly days: Days; readonly excludeDays: ExcludeDays; static readonly SHORT_OVERLAY_LENGTH = 7; constructor(runsFrom: Moment, runsTo: Moment, days: Days, excludeDays?: ExcludeDays); get id(): string; get binaryDays(): number; /** * Count the number of days that the overlay shares with this schedule and return true if the max has been exceeded */ getOverlap(overlay: ScheduleCalendar): OverlapType; /** * Add each date in the range as an exclude day */ addExcludeDays(overlay: ScheduleCalendar): ScheduleCalendar[]; /** * Returns the overlapping days between schedules (does not account for exclude days) */ private sharedDays; /** * Remove the given date range from this schedule and return one or two calendars */ divideAround(calendar: ScheduleCalendar): ScheduleCalendar[]; /** * Remove the given days from the calendar then tighten the dates */ clone(start: Moment, end: Moment, removeDays?: Days, excludeDays?: ExcludeDays): ScheduleCalendar; private removeDays; /** * Convert to a GTFS Calendar object */ toCalendar(serviceId: number): Calendar; /** * Convert exclude days to GTFS Calendar Dates */ toCalendarDates(serviceId: number): CalendarDate[]; /** * Returns true if this calendar would not be valid on any days before the given calendar starts */ canMerge(calendar: ScheduleCalendar): boolean; /** * Return a new calendar starting from the runsFrom of this calendar and running to the runsTo of the given calendar. * * Exclude days are merged together. */ merge(calendar: ScheduleCalendar): ScheduleCalendar; /** * Shift the calendar forward a day */ shiftForward(): ScheduleCalendar; /** * Shift the calendar back a day */ shiftBackward(): ScheduleCalendar; } export type ExcludeDays = { [date: string]: Moment; }; export interface Days { 0: 0 | 1; 1: 0 | 1; 2: 0 | 1; 3: 0 | 1; 4: 0 | 1; 5: 0 | 1; 6: 0 | 1; } export type BankHoliday = string; export declare enum OverlapType { None = 0, Short = 1, Long = 2 } export declare const NO_DAYS: Days;