import type { LearningContent } from "@/types";
import { assertUnreachable } from "@/utils/utils";

export interface LearningContentIdentifier {
  title: string;
  icon: string;
}

export function learningContentTypeData(
  lc: LearningContent
): LearningContentIdentifier {
  switch (lc.content_type) {
    case "learnpath.LearningContentAssignment": {
      let title = "unknown";
      if (lc.assignment_type === "CASEWORK") {
        title = "Geleitete Fallarbeit";
      } else if (lc.assignment_type === "PREP_ASSIGNMENT") {
        title = "Vorbereitungsaufgabe";
      } else if (lc.assignment_type === "REFLECTION") {
        title = "Reflexion";
      }
      return {
        title: title,
        icon: "it-icon-lc-assignment",
      };
    }
    case "learnpath.LearningContentAttendanceCourse":
      return { title: "Präsenzkurs", icon: "it-icon-lc-training" };
    case "learnpath.LearningContentDocumentList":
      return { title: "Dokumente", icon: "it-icon-lc-document" };
    case "learnpath.LearningContentLearningModule":
      return { title: "Lernmodul", icon: "it-icon-lc-learning-module" };
    case "learnpath.LearningContentMediaLibrary":
      return { title: "Mediathek", icon: "it-icon-lc-media-library" };
    case "learnpath.LearningContentVideo":
      return { title: "Video", icon: "it-icon-lc-video" };
    case "learnpath.LearningContentTest":
      return { title: "Test", icon: "it-icon-lc-test" };
    case "learnpath.LearningContentRichText":
      return { title: "Text", icon: "it-icon-lc-resource" };
    case "learnpath.LearningContentFeedback":
      return { title: "Feedback", icon: "it-icon-lc-feedback" };
    case "learnpath.LearningContentPlaceholder":
      return { title: "In Umsetzung", icon: "it-icon-lc-document" };
  }

  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  // @ts-ignore
  return assertUnreachable(`did not handle ${lc.content_type}`);
}
