import { get, post } from '#/api/http'

import { BasicService } from '../basic'

class TaskMgrService extends BasicService {
  // 获取考试班级信息
  async getClassInfo(classId: any) {
    return await get<any>(
      `/school/recordReport/listClassInfo?recordId=${classId}`,
    )
  }
  // 获取知识点
  async getListPaperKnowledge(recordId: any) {
    return await get<any>(`/school/recordReport/listPaperKnowledge`, {
      recordId,
    })
  }

  // 作业整体情况
  async getListRecord(recordId: any, titleId: any, markType: number) {
    return await get<any>(`/school/recordReport/listRecord`, {
      recordId,
      titleId,
      markType,
    })
  }
  // 查看题目满分/非满分情况
  async getListTitleStudentInfo(recordId: any, titleId: any, markType: number) {
    return await get<any>(`/school/recordReport/listTitleStudentInfo`, {
      recordId,
      titleId,
      markType,
    })
  }

  // async getStudentInfo(recordId: any, classId: any, status?: any) {
  //   return await get<any>(`/api/main/school/recordReport/listStudentInfo`, {
  //     recordId,
  //     classId,
  //     status,
  //   })
  // }

  // 根据ID获取试卷详情
  async getPaperDetail(id: any) {
    return await get<any>(`/school/paper/get/${id}`)
  }

  // 查看学生试卷详情
  async getPaperRecordDetail(recordId: any) {
    return await post<any>(`/school/paper/getPaperRecordDetail`, {
      recordId,
    })
  }
  // 获取试卷详情
  async getpaperReleaseRecordDetail(recordId: any) {
    return await get<any>(`/school/paperReleaseRecord/get/${recordId}`)
  }

  // 学生个人情况
  async getStudentInfo(recordId: any, classId: any, status?: any) {
    return await get<any>(`/school/recordReport/listUserStaticData`, {
      recordId,
      classId,
      status,
    })
  }

  // 重新批改学生试卷
  async regradePaper(recordId: any) {
    return await post<any>(`/school/paper/regrade`, {
      recordId,
    })
  }

  // 统计试卷记录学生完成信息
  async getListRecordStudentInfo(taskId: any, status: any) {
    return await get<any>(`/school/recordReport/listRecordStudentInfo`, {
      taskId,
      status,
    })
  }

  // 获取老师的班级列表
  async getTeacherClassList() {
    return await get<any>(`/org/class/listByTeacher`)
  }

  // 开始/结束讲解
  async questionExplainShare(data: {
    classId: string
    questionId: string
    recordId: string
    status: number
  }) {
    return await post<any>(`/school/questionExplain/share`, data)
  }

  // 题目讲解心跳
  async questionExplainHeartbeat(classId: string) {
    return await post<any>(
      `/school/questionExplain/heartbeat?classId=${encodeURIComponent(classId)}`,
    )
  }

  // 获取试卷详情
  // async getpaperReleaseRecordDetail(recordId: any) {
  //   return await get<any>(`/school/paperReleaseRecord/get/${recordId}`)
  // }
  //   return await get<any>(`/school/recordReport/listClassInfo?recordId=${classId}`)
  // }

  async teacherGradeItem(data: {
    actualScore: number
    correctResult: number
    itemId: number
    submitAnswerPic?: string
    teacherAnalyze?: string
  }) {
    return await post<any>(`/school/paper/userRecord/teacherGradeItem`, data)
  }

  protected findPageUrl(): string {
    return '/school/task/list'
  }

  protected removeUrl(): string {
    throw new Error('Method not implemented.')
  }

  protected saveOrUpdateUrl(): string {
    return '/school/task/publish'
  }
}

export const taskMgrService = new TaskMgrService()
