import type {Circle} from '@/services/circle';

export interface LearningContentBlock {
  type: 'web-based-training' | 'competence' | 'exercise' | 'knowledge';
  value: {
    description: string;
  },
  id: string;
}

export interface VideoBlock {
  type: 'video';
  value: {
    description: string;
    url: string;
  },
  id: string;
}

export interface PodcastBlock {
  type: 'podcast';
  value: {
    description: string;
    url: string;
  },
  id: string;
}

export interface DocumentBlock {
  type: 'document';
  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 LearningWagtailPage {
  readonly id: number;
  readonly title: string;
  readonly slug: string;
  readonly translation_key: string;
  completed?: boolean;
}

export interface LearningContent extends LearningWagtailPage {
  type: 'learnpath.LearningContent';
  minutes: number;
  contents: (LearningContentBlock | VideoBlock | PodcastBlock | DocumentBlock)[];
  parentLearningSequence?: LearningSequence;
  parentLearningUnit?: LearningUnit;
  nextLearningContent?: LearningContent;
  previousLearningContent?: LearningContent;
}

export interface LearningUnitQuestion extends LearningWagtailPage {
  type: 'learnpath.LearningUnitQuestion';
  parentLearningSequence?: LearningSequence;
  parentLearningUnit?: LearningUnit;
}

export interface LearningUnit extends LearningWagtailPage {
  type: 'learnpath.LearningUnit';
  learningContents: LearningContent[];
  minutes: number;
  parentLearningSequence?: LearningSequence;
  children: LearningUnitQuestion[];
  last?: boolean;
}

export interface LearningSequence extends LearningWagtailPage {
  type: 'learnpath.LearningSequence';
  icon: string;
  learningUnits: LearningUnit[];
  minutes: number;
}

export type CircleChild = LearningContent | LearningUnit | LearningSequence | LearningUnitQuestion;

export interface WagtailCircle extends LearningWagtailPage {
  type: 'learnpath.Circle';
  children: CircleChild[];
  description: string;
}

export interface Topic extends LearningWagtailPage {
  type: 'learnpath.Topic';
  is_visible: boolean;
  circles: Circle[];
}

export type LearningPathChild = Topic | WagtailCircle;

export interface LearningPath extends LearningWagtailPage {
  type: 'learnpath.LearningPath';
  children: LearningPathChild[];
  topics: Topic[];
  circles: Circle[];
}

export interface CircleCompletion {
  id: number;
  created_at: string;
  updated_at: string;
  user: number;
  page_key: string;
  page_type: string;
  circle_key: string;
  completed: boolean;
  json_data: any;
}

export interface CircleDiagramData  {
          index: number
          title:  string
          icon: string
          startAngle: number
          endAngle: number
          arrowStartAngle: number
          arrowEndAngle:  number
          done: boolean
}
