/**
 * 学生模块 API 存根文件
 * 原模块已剥离至 competition-management-system-stripped-modules/
 * 仅保留被赛事模块引用的类型和接口定义
 */
import request from "@/utils/request";
import type { PaginationParams, PaginationResponse } from "@/types/api";

export interface Student {
  id: number;
  userId: number;
  tenantId: number;
  classId: number;
  studentNo?: string;
  phone?: string;
  idCard?: string;
  gender?: number;
  birthDate?: string;
  enrollmentDate?: string;
  parentName?: string;
  parentPhone?: string;
  address?: string;
  description?: string;
  validState: number;
  user?: {
    id: number;
    username: string;
    nickname: string;
    email?: string;
    avatar?: string;
    validState: number;
  };
  class?: {
    id: number;
    name: string;
    code: string;
    type: number;
    grade?: {
      id: number;
      name: string;
      code: string;
      level: number;
    };
  };
}

export async function getStudentsList(
  params: PaginationParams & { classId?: number }
): Promise<PaginationResponse<Student>> {
  return request.get<any, PaginationResponse<Student>>("/students", { params });
}

export async function getStudentByUserId(userId: number): Promise<Student> {
  return request.get<any, Student>(`/students/user/${userId}`);
}

export const studentsApi = {
  getList: getStudentsList,
  getByUserId: getStudentByUserId,
};
