microtecflix/src/types.ts

88 lines
1.9 KiB
TypeScript

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
createdAt: string;
}
export interface Course {
id: string;
title: string;
description: string;
thumbnail: string;
category: string;
isLocked?: boolean; // If true, requires payment/unlock
price?: number; // Cost to unlock if locked (e.g. 89.90)
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
createdAt: string;
}
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;
status: 'PENDING' | 'RECEIVED' | 'CONFIRMED' | 'OVERDUE' | 'REFUNDED';
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;
}