vbv/client/src/types.ts

269 lines
5.0 KiB
TypeScript

import type { Circle } from "@/services/circle";
export type CourseCompletionStatus = "unknown" | "fail" | "success";
export type LearningContentType =
| "assignment"
| "book"
| "document"
| "exercise"
| "media_library"
| "online_training"
| "resource"
| "test"
| "video";
export interface LearningContentBlock {
type: LearningContentType;
value: {
description: string;
};
id: string;
}
export interface AssignmentBlock {
type: "assignment";
value: {
description: string;
url: string;
};
id: string;
}
export interface BookBlock {
type: "book";
value: {
description: string;
url: string;
};
id: string;
}
export interface DocumentBlock {
type: "document";
value: {
description: string;
url: string;
};
id: string;
}
export interface ExerciseBlock {
type: "exercise";
value: {
description: string;
url: string;
};
id: string;
}
export interface MediaLibraryBlock {
type: "media_library";
value: {
description: string;
url: string;
};
id: string;
}
export interface OnlineTrainingBlock {
type: "online_training";
value: {
description: string;
url: string;
};
id: string;
}
export interface ResourceBlock {
type: "resource";
value: {
description: string;
url: string;
};
id: string;
}
export interface TestBlock {
type: "test";
value: {
description: string;
url: string;
};
id: string;
}
export interface VideoBlock {
type: "video";
value: {
description: string;
url: string;
};
id: string;
}
export interface CircleGoal {
type: "goal";
value: string;
id: string;
}
export interface CircleJobSituation {
type: "job_situation";
value: string;
id: string;
}
export interface CourseWagtailPage {
readonly id: number;
readonly title: string;
readonly slug: string;
readonly translation_key: string;
completion_status: CourseCompletionStatus;
}
export interface LearningContent extends CourseWagtailPage {
type: "learnpath.LearningContent";
minutes: number;
contents: (
| AssignmentBlock
| BookBlock
| DocumentBlock
| ExerciseBlock
| MediaLibraryBlock
| OnlineTrainingBlock
| ResourceBlock
| TestBlock
| VideoBlock
)[];
parentCircle: Circle;
parentLearningSequence?: LearningSequence;
parentLearningUnit?: LearningUnit;
nextLearningContent?: LearningContent;
previousLearningContent?: LearningContent;
}
export interface LearningUnitQuestion extends CourseWagtailPage {
type: "learnpath.LearningUnitQuestion";
parentLearningSequence?: LearningSequence;
parentLearningUnit?: LearningUnit;
}
export interface LearningUnit extends CourseWagtailPage {
type: "learnpath.LearningUnit";
learningContents: LearningContent[];
minutes: number;
parentLearningSequence?: LearningSequence;
children: LearningUnitQuestion[];
last?: boolean;
}
export interface LearningSequence extends CourseWagtailPage {
type: "learnpath.LearningSequence";
icon: string;
learningUnits: LearningUnit[];
minutes: number;
}
export type CircleChild =
| LearningContent
| LearningUnit
| LearningSequence
| LearningUnitQuestion;
export interface WagtailCircle extends CourseWagtailPage {
type: "learnpath.Circle";
children: CircleChild[];
description: string;
}
export interface Topic extends CourseWagtailPage {
type: "learnpath.Topic";
is_visible: boolean;
circles: Circle[];
}
export type LearningPathChild = Topic | WagtailCircle;
export interface CourseCompletion {
id: number;
created_at: string;
updated_at: string;
user: number;
page_key: string;
page_type: string;
page_slug: string;
course: number;
completion_status: CourseCompletionStatus;
additional_json_data: any;
}
export interface CircleDiagramData {
index: number;
title: string;
icon: string;
startAngle: number;
endAngle: number;
arrowStartAngle: number;
arrowEndAngle: number;
done: boolean;
}
export interface Course {
id: number;
name: string;
category_name: string;
}
export interface CourseCategory {
id: number;
name: string;
general: boolean;
}
export interface MediaDocument {
type: "Documents";
value: number;
id: string;
}
export interface MediaLink {
type: "Links";
id: string;
value: {
title: string;
description: string;
link_display_text: string;
url: string;
};
}
export interface MediaContentCollection {
type: "content_collection";
value: {
title: string;
contents: (MediaDocument | MediaLink)[];
};
}
export interface MediaCategoryPage extends CourseWagtailPage {
type: "media_library.MediaCategoryPage";
overview_icon: string;
introduction_text: string;
description_title: string;
description_text: string;
items: {
type: "item";
value: string;
id: string;
};
course_category: CourseCategory;
body: MediaContentCollection[];
}
export interface MediaLibraryPage extends CourseWagtailPage {
type: "media_library.MediaLibraryPage";
course: Course;
children: MediaCategoryPage[];
}