export enum Role { USER = 'user', MODEL = 'model', } export enum MessageType { TEXT = 'text', AUDIO = 'audio', IMAGE = 'image', VIDEO = 'video', } export interface ChatMessage { id: string; role: Role; type: MessageType; content: string; // Text content or base64/url for media model?: string; // Model used for generation metadata?: { isThinking?: boolean; audioUrl?: string; // For TTS playback or User recording imageUrl?: string; videoUrl?: string; transcription?: string; // For audio inputs }; timestamp: number; } // New Interface for Chat Sessions export interface ChatSession { id: string; title: string; messages: ChatMessage[]; createdAt: number; updatedAt: number; } export enum AppMode { CHAT = 'chat', READING = 'reading', LISTENING = 'listening', // New Listening Mode SPEAKING = 'speaking', CREATIVE = 'creative', TRANSLATION = 'translation', OCR = 'ocr', } export type Language = 'en' | 'ja' | 'zh'; // Specific Gemini Models export enum ModelNames { TEXT_FAST = 'gemini-2.5-flash', TEXT_REASONING = 'gemini-3-pro-preview', TTS = 'gemini-2.5-flash-preview-tts', IMAGE_GEN = 'imagen-4.0-generate-001', IMAGE_EDIT = 'gemini-2.5-flash-image', // Nano Banana VIDEO_GEN = 'veo-3.1-fast-generate-preview', TRANSCRIPTION = 'gemini-2.5-flash', } export const AVAILABLE_CHAT_MODELS = [ { id: 'gemini-3-pro-preview', name: 'Gemini 3 Pro (Default - Best Reasoning)' }, { id: 'gemini-2.5-flash', name: 'Gemini 2.5 Flash (Fast & Balanced)' } ]; // Speaking Mode Types export interface PronunciationFeedback { score: number; // 0-100 transcription: string; response: string; // AI Reply in Japanese translation: string; // AI Reply in English/Native Lang pronunciationIssues: string[]; // List of specific phoneme/pitch errors advice: string; // General advice } export interface Scenario { id: string; title: string; icon: string; description: string; initialMessage: string; // What AI says first initialTranslation?: string; // Translation of initial message role: string; // Who the AI is } // Reading Mode Types export enum ReadingDifficulty { BEGINNER = 'beginner', // N5/N4 INTERMEDIATE = 'intermediate', // N3/N2 ADVANCED = 'advanced', // N1+ } export interface ReadingLesson { title: string; japaneseContent: string; translation: string; vocabulary: { word: string; reading: string; meaning: string }[]; grammarPoints?: { point: string; explanation: string }[]; } export interface ReadingLessonRecord extends ReadingLesson { id: string; topic: string; difficulty: ReadingDifficulty; timestamp: number; chatHistory?: ChatMessage[]; // Persist tutor chat } // Listening Mode Types export interface QuizQuestion { id: string; question: string; options: string[]; correctIndex: number; explanation: string; } export interface ListeningLesson { title: string; script: string; // The full Japanese text (initially hidden) translation: string; vocabulary: { word: string; reading: string; meaning: string }[]; questions: QuizQuestion[]; grammarPoints?: { point: string; explanation: string }[]; } export interface ListeningLessonRecord extends ListeningLesson { id: string; topic: string; difficulty: ReadingDifficulty; timestamp: number; chatHistory?: ChatMessage[]; } // OCR Mode Types export interface OCRAnalysis { extractedText: string; detectedLanguage: string; summary: string; vocabulary: { word: string; reading: string; meaning: string }[]; grammarPoints: { point: string; explanation: string }[]; } export interface OCRRecord { id: string; timestamp: number; imagePreview: string; analysis: OCRAnalysis; } // Translation Mode Types export interface TranslationRecord { id: string; sourceText: string; targetText: string; sourceLang: string; // e.g. 'Detected Language' or 'English' targetLang: string; // e.g. 'Japanese' timestamp: number; } // Backup Data Type export interface AppDataBackup { version: number; createdAt: number; language: Language; chatSessions: ChatSession[]; translationHistory: TranslationRecord[]; readingHistory?: ReadingLessonRecord[]; ocrHistory?: OCRRecord[]; listeningHistory?: ListeningLessonRecord[]; }