export type UserRole = 'admin' | 'student'; export type SubscriptionStatus = 'ACTIVE' | 'OVERDUE' | 'CANCELED' | 'TRIAL'; export interface User { id: string; name: string; email: string; password?: string; role: UserRole; subscriptionStatus: SubscriptionStatus; asaasCustomerId: string | null; unlockedCourses?: string[]; // IDs of courses unlocked individually cpf?: string; birthDate?: string; whatsapp?: string; avatarUrl?: string; trialEndsAt?: string | null; totalLikes?: number; totalDislikes?: number; lessonReactions?: any[]; progress?: any[]; cep?: string; address?: string; number?: string; complement?: string; reference?: string; neighborhood?: string; city?: string; state?: string; createdAt: string; } export interface SystemSettings { trialDurationDays: number; asaasEnvironment: 'sandbox' | 'production'; asaasApiKey: string; asaasWebhookUrl: string; asaasWebhookSecret: string; helpText: string; enableBoleto?: boolean; evolutionApiUrl?: string; evolutionApiKey?: string; evolutionInstance?: string; whatsappConnected?: boolean; whatsappPhoneNumber?: string; brandName?: string; brandSlogan?: string; cnpj?: string; address?: string; termsOfUse?: string; privacyPolicy?: string; featuredCourseId?: string | null; heroImageUrl?: string | null; heroTitle?: string | null; heroDescription?: string | null; } export interface Course { id: string; title: string; description: string; thumbnail: string; category: string; certificateMode?: 'PER_MODULE' | 'FULL_COURSE'; isLocked?: boolean; // Se true, o aluno precisa comprar ou assinar para acessar price?: number; // Preço para compra avulsa (vitalícia) createdAt: string; lessons?: Lesson[]; } export interface Plan { id: string; title: string; description: string; price: number; cycle: 'MONTHLY' | 'YEARLY' | 'LIFETIME'; includedCourses: string[]; // Array vazio significa 'Global/Todos os cursos' active: boolean; createdAt: string; } export interface Module { id: string; courseId: string; title: string; order: number; createdAt: string; } export interface Lesson { id: string; moduleId: string; title: string; videoUrl: string; // YouTube embed link or direct HTML5 mp4/hls link videoType: 'youtube' | 'direct'; order: number; content: string; // Additional lesson resources/description thumbnailUrl?: string; createdAt: string; reaction?: string | null; } export interface Note { id: string; userId: string; lessonId: string; content: string; createdAt: string; } export interface LessonProgress { id: string; userId: string; lessonId: string; watchedPercentage: number; completed: boolean; updatedAt: string; } export interface WebhookLog { id: string; event: string; payload: string; receivedAt: string; } export interface SubscriptionPayment { id: string; userId: string; value: number; planId?: string; courseId?: string; status: 'PENDING' | 'RECEIVED' | 'CONFIRMED' | 'OVERDUE' | 'REFUNDED' | 'DELETED' | 'CANCELED'; billingType: 'PIX' | 'CREDIT_CARD' | 'BOLETO'; invoiceUrl: string; dueDate: string; paidAt: string | null; createdAt: string; } export interface AdminDashboardStats { mrr: number; activeSubscribers: number; overdueSubscribers: number; canceledSubscribers: number; } export interface Question { id: string; text: string; options: string[]; correctOptionIndex: number; } export interface ModuleActivity { id: string; moduleId: string; questions: Question[]; createdAt: string; } export interface Notification { id: string; userId: string; message: string; read: boolean; createdAt: string; } export interface ModuleGrade { id: string; userId: string; activityId: string; score: number; passed: boolean; createdAt: string; } export interface Certificate { id: string; userId: string; courseId: string | null; moduleId: string | null; certificateType: 'COURSE' | 'MODULE'; unlockedAt: string; finalGrade: number | null; courseName: string; moduleName: string | null; }