package com.qmth.teachcloud.mark.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qmth.teachcloud.common.enums.mark.MarkMode;
import com.qmth.teachcloud.mark.dto.mark.entrance.MarkEntranceDto;
import com.qmth.teachcloud.mark.dto.mark.manage.MarkQualityChartDto;
import com.qmth.teachcloud.mark.dto.mark.manage.MarkQualityDto;
import com.qmth.teachcloud.mark.dto.mark.manage.MarkUserGroupProgressDto;
import com.qmth.teachcloud.common.bean.dto.mark.MarkUser;
import com.qmth.teachcloud.mark.entity.MarkUserGroup;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
 * <p>
 * 评卷员表 服务类
 * </p>
 *
 * @author xf
 * @since 2023-09-22
 */
public interface MarkUserGroupService extends IService<MarkUserGroup> {

    IPage<MarkEntranceDto> listEntranceGroup(Long examId, String courseCode, String paperNumber, Integer pageNumber, Integer pageSize);

    List<MarkUser> listGroupUserByExamIdAndPaperNumberAndGroupNumberAndClassName(Long examId, String paperNumber, Integer number, String className);

    IPage<MarkUserGroupProgressDto> pageGroupUserByExamIdAndPaperNumberAndGroupNumber(Long examId, String paperNumber, Integer groupNumber, String loginName, String className, Integer pageNumber, Integer pageSize);

    void addMarkUserGroup(Long examId, String paperNumber, Integer groupNumber, List<Long> userIds);

    void setTopCount(List<Long> markUserGroupIds, Integer topCount);

    MarkUserGroup getByExamIdAndPaperNumberAndGroupNumberAndUserId(Long examId, String paperNumber, Integer groupNumber, Long userId);

    void deleteMarker(Long markUserGroupId);

    void releaseMarker(List<Long> markUserGroupIds);

    boolean resetMarker(MarkUserGroup markUserGroup);

    void resetById(Long id);

    IPage<MarkQualityDto> pageQuality(Long examId, String paperNumber, Integer groupNumber, String loginName, Integer pageNumber, Integer pageSize);

    void updateQuality(Long examId, String paperNumber, Integer groupNumber);

    List<MarkUserGroup> listByExamIdAndPaperNumberAndGroupNumber(Long examId, String paperNumber, Integer groupNumber);

    void updateQualityById(Long markUserGroupId, int finishCount, int headerFinishCount, int validCount, double v, double avgScore, double stdevScore, double maxScore, double minScore);

    List<MarkQualityChartDto> listQualityChart(Long examId, String paperNumber, Integer groupNumber);
    
    List<MarkUserGroup> listByExamIdAndPaperNumberAndUserId(Long examId, String paperNumber, Long userId);

    void deleteByExamIdAndPaperNumberAndGroupNumber(Long examId, String paperNumber, Integer groupNumber);

    void updateMode(Long examId, String paperNumber, Integer groupNumber, Long userId, MarkMode mode);

    List<String> listBindMarkers(Long examId, String paperNumber, Integer groupNumber);
}
