import { request } from '@/service/request';

// 参数接口
export interface GetAttendanceListParams {
  id?: number;
  studentId?: number;
  month?: number;
  startTime?: string;
  endTime?: string;
  teacherId?: number;
  classId?: number;
}

// 响应接口
export interface GetStudentListRes {
  status: boolean;
  msg: string;
  data: Record<string, unknown>;
  total: number;
}

/**
 * 综合查询签到打卡信息
 * @param {string} pageNum
 * @param {string} pageSize
 * @param {object} params AttendanceDto
 * @param {number} params.id
 * @param {number} params.studentId
 * @param {number} params.month
 * @param {object} params.startTime
 * @param {object} params.endTime
 * @param {number} params.teacherId
 * @param {number} params.classId
 * @returns
 */
export function queryAttendance(
  pageNum: number,
  pageSize: number,
  params: GetAttendanceListParams
): Promise<Service.RequestResult<GetStudentListRes[]>> {
  return request.post(`/attendance/queryAttendance?pageNum=${pageNum}&pageSize=${pageSize}`, params);
}

export interface ClassParams {
  id?: number;
  name?: string;
  manageId?: number;
  assistantId?: number;
  createTime?: Record<string, unknown>;
  modifyTime?: Record<string, unknown>;
  createUid?: number;
  disabled?: string;
}

/**
 * 查询所有的班级类
 * @returns
 */
export function queryClassAll(): Promise<Service.RequestResult<ClassParams[]>> {
  return request.get(`/class/selectTotal`);
}

export interface ClassRoomParams {
  id?: number;
  name?: string;
  managerId?: number;
  address?: string;
  manager?: string;
  floor?: number;
  capacity?: number;
  comment?: string;
  disabled?: string;
  createTime?: Record<string, unknown>;
  modifyTime?: Record<string, unknown>;
  createUid?: number;
}

export function queryClassRoomList(
  pageNum: number,
  pageSize: number,
  params: ClassRoomParams
): Promise<Service.RequestResult<ClassRoomParams[]>> {
  return request.post(`/classroom/query?pageNum=${pageNum}&pageSize=${pageSize}`, params);
}
