// Auto-generated types (from Model Contract)

export interface User {
  id?: string;
  username: string;
  passwordHash: string;
  nickname?: string;
  role?: string;
  phone?: string;
  avatarUrl?: string;
  createdAt?: string;
  updatedAt?: string;
}

export interface Courses {
  id: string;
  userId?: string;
  title: string;
  description?: string;
  instructor?: string;
  price?: number;
  coverUrl?: string;
  category?: string;
  createdAt?: string;
  updatedAt?: string;
}

export interface Chapters {
  id: string;
  userId?: string;
  courseId?: string;
  title: string;
  sortOrder?: number;
  durationMin?: number;
  createdAt?: string;
  updatedAt?: string;
}

export interface Students {
  id: string;
  userId?: string;
  name: string;
  email?: string;
  enrolledAt?: string;
  progress?: number;
  createdAt?: string;
  updatedAt?: string;
}

export interface Assignments {
  id: string;
  userId?: string;
  courseId?: string;
  title: string;
  description?: string;
  dueDate?: string;
  maxScore?: number;
  createdAt?: string;
  updatedAt?: string;
}

export interface CreateUserInput {
  username: string;
  passwordHash: string;
  nickname?: string;
  role?: string;
  phone?: string;
  avatarUrl?: string;
}

export interface CreateCoursesInput {
  userId?: string;
  title: string;
  description?: string;
  instructor?: string;
  price?: number;
  coverUrl?: string;
  category?: string;
}

export interface CreateChaptersInput {
  userId?: string;
  courseId?: string;
  title: string;
  durationMin?: number;
}

export interface CreateStudentsInput {
  userId?: string;
  name: string;
  email?: string;
}

export interface CreateAssignmentsInput {
  userId?: string;
  courseId?: string;
  title: string;
  description?: string;
  dueDate?: string;
}

export interface UpdateUserInput {
  username?: string;
  passwordHash?: string;
  nickname?: string;
  role?: string;
  phone?: string;
  avatarUrl?: string;
}

export interface UpdateCoursesInput {
  userId?: string;
  title?: string;
  description?: string;
  instructor?: string;
  price?: number;
  coverUrl?: string;
  category?: string;
}

export interface UpdateChaptersInput {
  userId?: string;
  courseId?: string;
  title?: string;
  durationMin?: number;
}

export interface UpdateStudentsInput {
  userId?: string;
  name?: string;
  email?: string;
}

export interface UpdateAssignmentsInput {
  userId?: string;
  courseId?: string;
  title?: string;
  description?: string;
  dueDate?: string;
}

// ─── Auth ───────────────────────────────────────────
export interface LoginInput {
  username: string;
  password: string;
}

export interface RegisterInput {
  username: string;
  password: string;
  nickname?: string;
}

export interface AuthResponse {
  token: string;
  user: User;
}

// ─── API ────────────────────────────────────────────
export interface ApiResponse<T> {
  data: T;
  message?: string;
}

export interface PaginatedResponse<T> {
  data: T[];
  total: number;
  page: number;
  pageSize: number;
}

export interface ErrorResponse {
  error: string;
  message: string;
  statusCode: number;
}

// ─── JWT ────────────────────────────────────────────
export interface JwtPayload {
  userId: string;
  username: string;
  role: string;
  iat?: number;
  exp?: number;
}
