
// Enterprise Architecture: Models & DTOs
// In a real Next.js app, these would mirror Prisma Schema and Zod definitions.

export enum UserRole {
  USER = 'USER',
  ADMIN = 'ADMIN',
  CREATOR = 'CREATOR',
  MANAGER = 'MANAGER'
}

export enum MaterialType {
  CODE = 'CODE',
  ASSET_ZIP = 'ASSET_ZIP',
  VIDEO = 'VIDEO'
}

// User DTO
export interface UserDTO {
  id: string;
  username: string;
  avatarUrl: string;
  role: UserRole;
  status: 'ACTIVE' | 'BANNED' | 'FLAGGED';
  createdAt: string;
  lastLogin: string;
}

// Comment DTO
export interface CommentDTO {
  id: string;
  content: string;
  author: UserDTO;
  createdAt: string;
}

// Material DTO (The core resource)
export interface MaterialDTO {
  id: string;
  title: string;
  description: string;
  type: MaterialType;
  contentUrl?: string; // URL for Video or Zip
  codeSnippet?: string; // For code snippets
  language?: string; // e.g., 'typescript', 'python'
  author: UserDTO;
  stats: {
    views: number;
    downloads: number;
    favorites: number;
  };
  tags: string[];
  createdAt: string;
  comments: CommentDTO[];
  favorites?: { userId: string; createdAt: string }[]; // For checking if current user favorited
}

// Admin / System Config
export interface SystemConfig {
  dbHost: string;
  dbPort: string;
  dbUser: string;
  dbPass: string;
  dbName: string;
  maintenanceMode: boolean;
  maxUploadMB: number;
}

// API Response Wrappers
export interface ApiResponse<T> {
  success: boolean;
  data?: T;
  error?: string;
  timestamp: string;
}

export interface LoginResponse {
  token: string; // JWT in real app
  user: UserDTO;
}

export interface PaginationResult<T> {
  items: T[];
  total: number;
  page: number;
  limit: number;
  hasNext: boolean;
}
