diff --git a/src/interface/generic/eduUnit.ts b/src/interface/generic/eduUnit.ts index 3995240..69526f6 100644 --- a/src/interface/generic/eduUnit.ts +++ b/src/interface/generic/eduUnit.ts @@ -12,4 +12,10 @@ export interface EducationalUnit { * The planned lessons are used to represent the substitution plan. */ plannedLessons: PlannedLesson[]; + + /** + * The type of the educational unit. + * The type can be "schoolClass", "room", or "teacher". + */ + type: 'schoolClass' | 'room' | 'teacher'; } diff --git a/src/interface/index.ts b/src/interface/index.ts index e7b750d..7c1f3d7 100644 --- a/src/interface/index.ts +++ b/src/interface/index.ts @@ -1,4 +1,5 @@ import { Course } from './course'; +import { EducationalUnit } from './generic/eduUnit'; import { Lesson } from './lesson'; import { PlannedLesson } from './plannedLesson'; import { Room } from './room'; @@ -8,6 +9,7 @@ import { Teacher } from './teacher'; export type { Course, + EducationalUnit, ISubstitutionPlan, Lesson, PlannedLesson, diff --git a/src/interface/room.ts b/src/interface/room.ts index ab8487a..94e5425 100644 --- a/src/interface/room.ts +++ b/src/interface/room.ts @@ -3,4 +3,6 @@ import { EducationalUnit } from './generic/eduUnit.js'; /** * A room represents a room in a school, which is used in the timetable. */ -export interface Room extends EducationalUnit {} +export interface Room extends EducationalUnit { + readonly type: 'room'; +} diff --git a/src/interface/schoolclass.ts b/src/interface/schoolclass.ts index 6cd2b57..1cb227e 100644 --- a/src/interface/schoolclass.ts +++ b/src/interface/schoolclass.ts @@ -6,6 +6,8 @@ import { Lesson } from './lesson.js'; * A school class represents a classical class or course in a school. */ export interface SchoolClass extends EducationalUnit { + readonly type: 'schoolClass'; + /** * The timetable of the school class. * It is a merge of all lessons and courses, where all courses get an id of `-1`. diff --git a/src/interface/teacher.ts b/src/interface/teacher.ts index bf778a8..0a8cbda 100644 --- a/src/interface/teacher.ts +++ b/src/interface/teacher.ts @@ -3,4 +3,6 @@ import { EducationalUnit } from './generic/eduUnit.js'; /** * A teacher represents a teacher in a school (obviously -_-). */ -export interface Teacher extends EducationalUnit {} +export interface Teacher extends EducationalUnit { + readonly type: 'teacher'; +} diff --git a/src/parser/schoolClass.ts b/src/parser/schoolClass.ts index cf622fb..452f35d 100644 --- a/src/parser/schoolClass.ts +++ b/src/parser/schoolClass.ts @@ -40,6 +40,7 @@ export class SchoolClassParser implements IndiwareParser { return { name: `${xml.Kurz}`, + type: 'schoolClass', timetable, courses, lessons, diff --git a/src/parser/substitutionPlan.ts b/src/parser/substitutionPlan.ts index 582bb2d..7061af8 100644 --- a/src/parser/substitutionPlan.ts +++ b/src/parser/substitutionPlan.ts @@ -37,6 +37,7 @@ export class SubstitutionPlanParser implements IndiwareParser rooms.push({ name: lesson.room.value, plannedLessons: [lesson], + type: 'room', }); } } @@ -51,6 +52,7 @@ export class SubstitutionPlanParser implements IndiwareParser teachers.push({ name: teacher, plannedLessons: [lesson], + type: 'teacher', }); } }