import { element, period } from "../webuntis/resources/index.js"; declare type lessonType = "lesson" | "officeHour" | "standby" | "breakSupervision" | "exam"; declare type lessonCode = "regular" | "cancelled" | "irregular"; declare type activityType = "Unterricht" | "Bereitschaft"; /** * Wrapper around the period objects returned by the WebUntis API. */ export declare class Period { /** * The lesson's id. */ readonly id: number; /** * Type of the lesson. */ readonly lessonType: lessonType; /** * Code that contains whether the lesson is regular, irregular or cancelled. */ readonly lessonCode: lessonCode; /** * Lesson number. Unique per student group. */ readonly lessonNumber: number; /** * Lesson text. */ readonly lessonText: string; /** * Describes a substitution if present. */ readonly substitutionText: string | null; /** * Activity type of the lesson. */ readonly activityType: activityType; /** * Student group for this lesson. */ readonly studentGroup: string | null; /** * Date of the lesson, formatted as `yyyy-mm-dd`. */ private date; /** * Start time of the lesson, formatted as `hh:mm`. */ private startTime; /** * End time of the lesson, formatted as `hh:mm`. */ private endTime; /** * Elements that are associated with this period, grouped by their type. * Each list is sorted by the element ids. */ readonly elements: { readonly classes: readonly PeriodElement[]; readonly teachers: readonly PeriodElement[]; readonly subjects: readonly PeriodElement[]; readonly rooms: readonly PeriodElement[]; }; constructor( /** * The lesson's id. */ id: number, /** * Type of the lesson. */ lessonType: lessonType, /** * Code that contains whether the lesson is regular, irregular or cancelled. */ lessonCode: lessonCode, /** * Lesson number. Unique per student group. */ lessonNumber: number, /** * Lesson text. */ lessonText: string, /** * Describes a substitution if present. */ substitutionText: string | null, /** * Activity type of the lesson. */ activityType: activityType, /** * Student group for this lesson. */ studentGroup: string | null, elements: { classes: PeriodElement[]; teachers: PeriodElement[]; subjects: PeriodElement[]; rooms: PeriodElement[]; }, /** * Date of the lesson, formatted as `yyyy-mm-dd`. */ date: string, /** * Start time of the lesson, formatted as `hh:mm`. */ startTime: string, /** * End time of the lesson, formatted as `hh:mm`. */ endTime: string); /** * Creates a new instance of this class. * @param period the period returned by WebUntis. * @returns the new instance */ static from(period: period): Period; /** * Return's the lesson's date as a string, formatted as `yyyy-mm-dd`. * @returns the date */ getDateAsString: () => string; /** * Parses the lesson's date into a JS {@link Date} object. * @returns the date object */ getDateAsObject: () => Date; /** * Return's the lesson's start time as a string, formatted as `hh:mm`. * @returns the start time */ getStartTimeAsString: () => string; /** * Combines the lesson's date and start time into a date time, formatted as `yyyy-mm-ddThh:mm`. * @returns the date time */ getStartDateTimeAsString: () => string; /** * Combines the lesson's date and start time into a date time and parses it into a {@link Date} object. * @returns the date object */ getStartDateTimeAsObject: () => Date; /** * Return's the lesson's end time as a string, formatted as `hh:mm`. * @returns the end time */ getEndTimeAsString: () => string; /** * Combines the lesson's date and end time into a date time, formatted as `yyyy-mm-ddThh:mm`. * @returns the date time */ getEndDateTimeAsString: () => string; /** * Combines the lesson's date and end time into a date time and parses it into a {@link Date} object. * @returns the date object */ getEndDateTimeAsObject: () => Date; /** * Checks whether two lessons have the same elements. * @param other the lesson to compare to * @returns whether the lessons have the same elements */ hasTheSameElementsAs: (other: Period) => boolean; /** * Checks whether this lesson deviates from its weekly schedule. * A deviation could be that the lesson is cancelled or has substituted or missing elements compared to its schedule. * @returns whether the period deviates from its schedule */ deviatesFromSchedule: () => boolean; /** * Checks whether two lessons belong to the same schedule. * Two lessons belong to the same schedule if they have the same lesson number, occur on the same weekday, and start and end at the same time. * @param other lesson to compare to * @returns whether the lessons belong to the same schedule */ belongsToSameScheduleAs(other: Period): boolean; /** * Checks whether two lessons can be combined into one longer lessons. * Two lessons can be combined if they belong to they both occur on the same date, belong to the same schedule ({@link Period.belongsToSameScheduleAs()}), * one takes place directly after the other, and both have the same lesson code and elements * @param other lesson to compare to * @returns whether the lessons can be combined */ canBeCombinedWith: (other: Period) => boolean; /** * Combines two lessons into one longer lesson. Should only be used after checking {@link Period.canBeCombinedWith()}. * @param other lesson to combine with * @returns a new period that takes the start date from the earlier of lessons and the end date from the later. All other properties are equal to this period */ combineWith(other: Period): Period; } /** * Wrapper around an element included in a {@link Period}. */ export declare class PeriodElement { /** * Id of the element. */ readonly id: number; /** * Short name of the element. */ readonly name: string; /** * Longer name of the element. */ readonly longName: string; originalId?: number; originalName?: string; constructor( /** * Id of the element. */ id: number, /** * Short name of the element. */ name: string, /** * Longer name of the element. */ longName: string); /** * Creates a new instance of this class. * @param element the element returned by WebUntis. * @returns an instance of either {@link PeriodElement} or {@link SubstitutedPeriodElement} */ static from(element: element): PeriodElement | SubstitutedPeriodElement; /** * Returns whether the element is substituted. * @returns whether the element is substituted */ isSubstituted: () => boolean; } /** * Wrapper around a substituted element included in a {@link Period}. */ export declare class SubstitutedPeriodElement extends PeriodElement { readonly originalId: number; readonly originalName: string; constructor(id: number, name: string, longName: string, originalId: number, originalName: string); } export {};