import type { AssignmentCompletionStatus as AssignmentCompletionStatusGenerated } from "@/gql/graphql"; import type { Circle } from "@/services/circle"; import type { Dayjs } from "dayjs"; import type { Component } from "vue"; export type LoginMethod = "local" | "sso"; export type CourseCompletionStatus = "UNKNOWN" | "FAIL" | "SUCCESS"; export interface BaseCourseWagtailPage { readonly id: number; readonly title: string; readonly slug: string; readonly content_type: string; readonly translation_key: string; readonly frontend_url: string; completion_status?: CourseCompletionStatus; completion_status_updated_at?: string; } export interface CircleLight { readonly id: number; readonly title: string; readonly translation_key: string; } export type LearningContent = | LearningContentAssignment | LearningContentAttendanceCourse | LearningContentDocumentList | LearningContentFeedback | LearningContentLearningModule | LearningContentMediaLibrary | LearningContentPlaceholder | LearningContentRichText | LearningContentEdoniqTest | LearningContentVideo; export type LearningContentType = LearningContent["content_type"]; export interface LearningContentInterface extends BaseCourseWagtailPage { readonly content_type: LearningContentType; readonly minutes: number; readonly description: string; readonly content_url: string; readonly can_user_self_toggle_course_completion: boolean; parentCircle: Circle; parentLearningSequence?: LearningSequence; parentLearningUnit?: LearningUnit; nextLearningContent?: LearningContent; previousLearningContent?: LearningContent; } export interface LearningContentAssignment extends LearningContentInterface { readonly content_type: "learnpath.LearningContentAssignment"; readonly content_assignment_id: number; readonly assignment_type: AssignmentType; readonly competence_certificate?: { id: number; title: string; slug: string; content_type: string; translation_key: string; frontend_url: string; } | null; } export interface LearningContentAttendanceCourse extends LearningContentInterface { readonly content_type: "learnpath.LearningContentAttendanceCourse"; } export interface LearningContentDocument { readonly type: "document"; readonly id: string; readonly value: MediaLibraryContentBlockValue; } export interface LearningContentDocumentList extends LearningContentInterface { readonly content_type: "learnpath.LearningContentDocumentList"; readonly documents: LearningContentDocument[]; } export interface LearningContentFeedback extends LearningContentInterface { readonly content_type: "learnpath.LearningContentFeedback"; } export interface LearningContentLearningModule extends LearningContentInterface { readonly content_type: "learnpath.LearningContentLearningModule"; } export interface LearningContentMediaLibrary extends LearningContentInterface { readonly content_type: "learnpath.LearningContentMediaLibrary"; } export interface LearningContentPlaceholder extends LearningContentInterface { readonly content_type: "learnpath.LearningContentPlaceholder"; } export interface LearningContentRichText extends LearningContentInterface { readonly content_type: "learnpath.LearningContentRichText"; readonly text: string; } export interface LearningContentEdoniqTest extends LearningContentInterface { readonly content_type: "learnpath.LearningContentEdoniqTest"; readonly checkbox_text: string; readonly has_extended_time_test: boolean; readonly content_assignment_id: number; readonly competence_certificate?: { id: number; title: string; slug: string; content_type: string; translation_key: string; frontend_url: string; } | null; } export interface LearningContentVideo extends LearningContentInterface { readonly content_type: "learnpath.LearningContentVideo"; } export interface LearningUnitPerformanceCriteria extends BaseCourseWagtailPage { readonly content_type: "competence.PerformanceCriteria"; readonly competence_id: string; parentLearningSequence?: LearningSequence; parentLearningUnit?: LearningUnit; } export interface LearningUnit extends BaseCourseWagtailPage { readonly content_type: "learnpath.LearningUnit"; readonly evaluate_url: string; readonly course_category: CourseCategory; readonly title_hidden: boolean; children: LearningUnitPerformanceCriteria[]; // additional frontend fields learningContents: LearningContent[]; minutes: number; parentLearningSequence?: LearningSequence; parentCircle?: Circle; last?: boolean; } export interface LearningSequence extends BaseCourseWagtailPage { readonly content_type: "learnpath.LearningSequence"; icon: string; learningUnits: LearningUnit[]; minutes: number; } export type CircleChild = LearningContentInterface | LearningUnit | LearningSequence; export interface WagtailLearningPath extends BaseCourseWagtailPage { readonly content_type: "learnpath.LearningPath"; course: Course; children: LearningPathChild[]; } export interface CircleGoal { type: "goal"; value: string; id: string; } export interface CircleJobSituation { type: "job_situation"; value: string; id: string; } export interface WagtailCircle extends BaseCourseWagtailPage { readonly content_type: "learnpath.Circle"; readonly description: string; readonly goal_description: string; readonly goals: CircleGoal[]; readonly job_situation_description: string; readonly job_situations: CircleJobSituation[]; readonly children: CircleChild[]; } export interface Topic extends BaseCourseWagtailPage { readonly content_type: "learnpath.Topic"; readonly is_visible: boolean; circles: Circle[]; } export type LearningPathChild = Topic | WagtailCircle; export interface CourseCompletion { readonly id: string; created_at: string; updated_at: string; readonly user: number; readonly page_id: number; readonly page_type: string; readonly course_session_id: number; completion_status: CourseCompletionStatus; additional_json_data: unknown; } export interface Course { id: number; title: string; category_name: string; slug: string; } export interface CourseCategory { id: number; name: string; general: boolean; } export type MediaLibraryContentBlockValue = { title: string; description: string; icon_url: string; link_display_text: string; url: string; open_window: boolean; }; export interface LearnMediaBlock { type: "learn_media"; id: string; value: MediaLibraryContentBlockValue; } export interface ExternalLinkBlock { type: "external_link"; id: string; value: MediaLibraryContentBlockValue; } export interface InternalLinkBlock { type: "internal_link"; id: string; value: MediaLibraryContentBlockValue; } export interface RelativeLinkBlock { type: "relative_link"; id: string; value: MediaLibraryContentBlockValue; } export type MediaBlock = | LearnMediaBlock | ExternalLinkBlock | InternalLinkBlock | RelativeLinkBlock; export type MediaBlockType = MediaBlock["type"]; export interface MediaContentCollection { type: "content_collection"; value: { title: string; description: string; contents: MediaBlock[]; }; } export interface MediaLibraryContentPage extends BaseCourseWagtailPage { readonly content_type: "media_library.MediaLibraryContentPage"; readonly icon_overview_url: string; readonly icon_detail_url: string; readonly description: string; readonly body: string; } export interface MediaLibraryCategoryPage extends BaseCourseWagtailPage { readonly content_type: "media_library.MediaLibraryCategoryPage"; readonly icon_url: string; readonly description: string; readonly children: MediaLibraryContentPage[]; } export interface MediaLibraryUrlPage extends BaseCourseWagtailPage { readonly content_type: "media_library.MediaLibraryUrlPage"; readonly icon_url: string; readonly content_url: string; readonly url_open_blank: boolean; readonly description: string; } export type MediaLibraryPageChild = MediaLibraryCategoryPage | MediaLibraryUrlPage; export interface MediaLibraryPage extends BaseCourseWagtailPage { readonly content_type: "media_library.MediaLibraryPage"; readonly course: Course; readonly description: string; readonly children: MediaLibraryPageChild[]; } export interface AssignmentPerformanceObjective { readonly type: "performance_objective"; readonly id: string; readonly value: { text: string; }; } export interface AssignmentTaskBlockExplanation { readonly type: "explanation"; readonly id: string; readonly value: { readonly text: string; }; } export interface AssignmentTaskBlockUserConfirmation { readonly type: "user_confirmation"; readonly id: string; readonly value: { readonly text: string; }; } export interface AssignmentTaskBlockUserTextInput { readonly type: "user_text_input"; readonly id: string; readonly value: { readonly text?: string; }; } export type AssignmentTaskBlock = | AssignmentTaskBlockExplanation | AssignmentTaskBlockUserConfirmation | AssignmentTaskBlockUserTextInput; export interface AssignmentTask { readonly type: "task"; readonly id: string; readonly value: { title: string; file_submission_required: boolean; content: AssignmentTaskBlock[]; }; } export interface AssignmentEvaluationSubTask { readonly type: "task"; readonly id: string; readonly value: { title: string; description: string; points: number; }; } export interface AssignmentEvaluationTask { readonly type: "task"; readonly id: string; readonly value: { title: string; description: string; max_points: number; sub_tasks: AssignmentEvaluationSubTask[]; }; } export type AssignmentType = | "CASEWORK" | "PREP_ASSIGNMENT" | "REFLECTION" | "CONDITION_ACCEPTANCE" | "EDONIQ_TEST"; export interface Assignment extends BaseCourseWagtailPage { readonly content_type: "assignment.Assignment"; readonly assignment_type: AssignmentType; readonly intro_text: string; readonly effort_required: string; readonly performance_objectives: AssignmentPerformanceObjective[]; readonly evaluation_description: string; readonly evaluation_document_url: string; readonly tasks: AssignmentTask[]; readonly evaluation_tasks: AssignmentEvaluationTask[]; readonly max_points: number; } export interface PerformanceCriteria extends BaseCourseWagtailPage { readonly content_type: "competence.PerformanceCriteria"; readonly competence_id: string; readonly circle: CircleLight; readonly course_category: CourseCategory; readonly learning_unit: BaseCourseWagtailPage; } export interface CompetencePage extends BaseCourseWagtailPage { readonly content_type: "competence.CompetencePage"; readonly competence_id: string; readonly children: PerformanceCriteria[]; } export interface CompetenceProfilePage extends BaseCourseWagtailPage { readonly content_type: "competence.CompetenceProfilePage"; readonly course: Course; readonly circles: CircleLight[]; readonly children: CompetencePage[]; } export interface CompetenceCertificateAssignment extends BaseCourseWagtailPage { assignment_type: "CASEWORK" | "EDONIQ_TEST"; max_points: number; learning_content: | (BaseCourseWagtailPage & { circle: CircleLight; }) | null; completion: { id: string; completion_status: AssignmentCompletionStatus; evaluation_submitted_at: string | null; evaluation_points: number | null; } | null; } export interface CompetenceCertificate extends BaseCourseWagtailPage { readonly content_type: "competence.CompetenceCertificate"; readonly assignments: CompetenceCertificateAssignment[]; } // dropdown export interface DropdownListItem { title: string; icon: Component | string; data: object; } export interface DropdownSelectable { id: number | string; name: string; iconName?: string; } export interface CircleExpert { user_id: string; user_email: string; user_first_name: string; user_last_name: string; circle_id: number; circle_slug: string; circle_translation_key: string; } export interface CircleDocument { id: string; name: string; file_name: string; url: string; course_session: number; learning_sequence: number; } export interface CourseSessionAttendanceCourse { id: number; course_session_id: number; learning_content_id: number; start: string; end: string; location: string; trainer: string; due_date_id: number; circle_title: string; } export interface CourseSessionAssignment { id: number; course_session_id: number; learning_content_id: number; submission_deadline_id: number; submission_deadline_start: string; evaluation_deadline_id: number; evaluation_deadline_start: string; } export interface CourseSession { id: number; created_at: string; updated_at: string; course: Course; title: string; start_date: string; end_date: string; learning_path_url: string; cockpit_url: string; competence_url: string; course_url: string; media_library_url: string; attendance_courses: CourseSessionAttendanceCourse[]; assignments: CourseSessionAssignment[]; documents: CircleDocument[]; users: CourseSessionUser[]; due_dates: DueDate[]; } export type Role = "MEMBER" | "EXPERT" | "TUTOR"; export interface CourseSessionUser { session_title: string; user_id: string; first_name: string; last_name: string; email: string; avatar_url: string; role: Role; } export interface ExpertSessionUser extends CourseSessionUser { role: "EXPERT"; circles: { id: number; title: string; slug: string; translation_key: string; }[]; } // document upload export interface DocumentUploadData { file: File | null; name: string; learningSequence: { id: number; name: string; }; } // notifications export type NotificationCategory = "USER_INTERACTION" | "PROGRESS" | "INFORMATION"; export interface Notification { // given by AbstractNotification model id: string; timestamp: string; unread: boolean; actor: string | null; verb: string; target: string | null; action_object: string | null; // given by Notification model notification_category: NotificationCategory; target_url: string | null; actor_avatar_url: string | null; course: string | null; } export type AssignmentCompletionStatus = AssignmentCompletionStatusGenerated; export interface UserDataText { text: string; } export interface UserDataConfirmation { confirmation: boolean; } export interface ExpertData { points?: number; text?: string; } export interface AssignmentCompletionData { // { // "": {"user_data": {"text": "some text from user"}}, // "": {"user_data": {"confirmation": true}}, // } [key: string]: { user_data?: UserDataText | UserDataConfirmation; expert_data?: ExpertData; }; } export interface AssignmentCompletion { id: string; created_at: string; updated_at: string; submitted_at: string; evaluation_submitted_at: string | null; assignment_user: string; assignment: number; course_session: number; completion_status: AssignmentCompletionStatus; evaluation_user: string | null; completion_data: AssignmentCompletionData; evaluation_grade: number | null; evaluation_points: number | null; } export type UpsertUserAssignmentCompletion = { assignment_id: number; course_session_id: number; completion_status: AssignmentCompletionStatus; completion_data: AssignmentCompletionData; }; export type EvaluationCompletionData = UpsertUserAssignmentCompletion & { assignment_user_id: string; evaluation_grade?: number; evaluation_points?: number; }; export interface UserAssignmentCompletionStatus { id: string; assignment_user_id: string; completion_status: AssignmentCompletionStatus; evaluation_grade: number | null; learning_content_page_id: number; } export type DueDate = { id: number; start: Dayjs; end: Dayjs; title: string; assignment_type_translation_key: string; date_type_translation_key: string; subtitle: string; url: string; course_session: number | null; page: number | null; };