// ─── Video Engine V1 — API client ──────────────────────────────────────────── // Talks to the backend curriculum-aligned script endpoints. No file paths ever // cross this boundary; segment ids are opaque hashes. import { apiGet, apiPost } from "@/lib/api/client"; import type { VideoScript } from "@/lib/video/types"; export type CurriculumHints = { chapter_name?: string; topics?: string[]; formulas?: string[]; definitions?: string[]; common_mistakes?: string[]; exam_importance?: string | null; pyq_frequency?: string | null; exam_weightage_marks?: number | null; prerequisites?: string[]; }; export type VideoScriptRequest = { chapter_slug: string; subject?: string; level?: string; mode?: string; duration_minutes?: number; language_preference?: string | null; curriculum_hints?: CurriculumHints; student_progress?: Record | null; }; export type SegmentAudioResponse = { segment_id: string; mode: string; audio_ready: boolean; audio_token: string | null; subtitle_text: string; message: string; }; export type VideoProgressResponse = { video_id: string; current_segment_index: number; completed_segment_ids: string[]; percent_complete: number; updated_at: string | null; }; export function generateVideoScript(payload: VideoScriptRequest) { return apiPost("/video/generate-script", payload); } export function generateSegmentAudio( segmentId: string, body: { teacher_script: string; language?: string; voice?: string | null }, ) { return apiPost( `/video/segment/${encodeURIComponent(segmentId)}/generate`, body, ); } export function getVideoProgress(videoId: string) { return apiGet(`/video/${encodeURIComponent(videoId)}/progress`); }