import { DefaultService } from '@lib/api';

export class AnalysisService {
    static async planStoryboard(prompt: string, projectId: string = 'canvas-session'): Promise<string[]> {
         try {
             // Use splitStoryboards to generate storyboard descriptions from text
             // This is an approximation as splitStoryboards expects a script content
             const response = await DefaultService.splitStoryboardsEndpoint({
                 novel_text: prompt,
                 project_id: projectId
             });
             const res = (response as any).data;
             
             if (res && res.storyboards) {
                 return res.storyboards.map((s: any) => s.visual_description || s.shot_title);
             }
             return [];
         } catch (e) {
             console.error("Plan Storyboard Error:", e);
             // Fallback to basic splitting if API fails
             return prompt.split('\n').filter(line => line.trim().length > 0);
         }
    }

    static async analyzeVideo(videoData: string, prompt: string, model?: string): Promise<string> {
        // TODO: Connect to backend video analysis
        return "Video analysis is currently disabled.";
    }
}
