import type {
  CircleSectorData,
  CircleSectorProgress,
} from "@/pages/learningPath/learningPathPage/LearningPathCircle.vue";
import {
  allFinishedInLearningSequence,
  someFinishedInLearningSequence,
} from "@/services/circle";
import type { CircleType } from "@/types";

export function calculateCircleSectorData(circle: CircleType): CircleSectorData[] {
  return circle.learning_sequences.map((ls) => {
    let progress: CircleSectorProgress = "none";
    if (allFinishedInLearningSequence(ls)) {
      progress = "finished";
    } else if (someFinishedInLearningSequence(ls)) {
      progress = "in_progress";
    }
    return {
      progress: progress,
    };
  });
}
