export interface SyncNotification {
  id: string; // UUID unique identifier
  sourceLanguage: string; // Language code from which sync will occur
  createdAt: number; // Creation timestamp
  updatedAt: number; // Last update timestamp
  status: "pending" | "processing" | "completed" | "error";
  processingLastUpdate?: number; // Last update timestamp during processing
  error?: {
    message: string;
    code: string;
    timestamp: number;
  };
  syncProgress?: {
    totalLanguages: number;
    completedLanguages: string[]; // Array of completed language codes (no race conditions)
    currentLanguage?: string;
    failedLanguages?: Array<{
      code: string;
      error: string;
    }>;
  };
}

export interface Lesson {
  id: string;
  uid: string;
  title: string;
  type: "READ" | "CODE" | "QUIZ";
  description: string;
  duration?: number;
  generated?: boolean;
  status?: "PENDING" | "GENERATING" | "DONE" | "ERROR";
  initialContent?: string;
  translations?: {
    [key: string]: {
      completionId: number;
      startedAt: number;
      completedAt?: number;
      error?: boolean;
    };
  };
  syncNotifications?: SyncNotification[];
}

export interface ParsedLink {
  name: string;
  text: string;
}

export type TDifficulty = "easy" | "beginner" | "intermediate" | "hard";

export type FormState = {
  description: string;
  duration: number;
  hasContentIndex: boolean;
  difficulty: TDifficulty;
  contentIndex: string;
  language?: string;
  technologies?: string[];
  isCompleted: boolean;
  variables: string[];
  currentStep: string;
  title: string;
  purpose: string;
  slug: string;
};

export type Syllabus = {
  lessons: Lesson[];
  courseInfo: FormState;
  feedback?: string;
  generationMode?: "next-three" | "continue-with-all";
  used_components?: { [componentName: string]: number };
  // sources: ParsedLink[]
};
