// Import and re-export shared entity types
import type {
  User,
  Courses,
  Chapters,
  Students,
  Assignments,
  ApiResponse,
  PaginatedResponse,
  ErrorResponse,
} from "@shared/types";

export type {
  User,
  Courses,
  Chapters,
  Students,
  Assignments,
  ApiResponse,
  PaginatedResponse,
  ErrorResponse,
};

// Auto-generated types (from Model Contract)

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 ────────────────────────────────────────────
// ─── JWT ────────────────────────────────────────────
export interface JwtPayload {
  userId: string;
  username: string;
  role: string;
  iat?: number;
  exp?: number;
}
