package cn.teammodel.service;

import cn.teammodel.common.IdRequest;
import cn.teammodel.model.dto.Appraise.*;
import cn.teammodel.model.entity.appraise.Appraise;
import cn.teammodel.model.entity.appraise.AppraiseTreeNode;
import cn.teammodel.model.vo.appraise.AppraiseRecordVo;
import cn.teammodel.model.vo.appraise.StudentReportVo;
import com.itextpdf.text.DocumentException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @author winter
 * @create 2023-11-20 17:46
 */
public interface EvaluationService {

    Appraise getTree(GetEvaluateTreeDto getEvaluateTreeDto);

    /**
    * 递归构建树
    */
    Appraise buildTree(Appraise appraise);

    /**
     * 递归扁平化树
     * @param trees: 树的列表
     * @param nodes: 扁平化后的节点列表
     * @author: winter
     * @date: 2023/11/21 16:40
     * @description:
     */
    void flattenTree(List<AppraiseTreeNode> trees, List<AppraiseTreeNode> nodes);

    /**
    * 新增评价树节点
    */
    Appraise insertNode(InsertNodeDto insertNodeDto);

    /**
    * 更新评价树节点
    */
    Appraise updateNode(UpdateNodeDto updateNodeDto);

    /**
    * 删除评价树节点,同时删除其子节点
    */
    Appraise deleteNode(DeleteNodeDto deleteNodeDto);

    /**
    * 给学生评价
    */
    void vote(AppraiseVoteDto appraiseVoteDto);

    List<AppraiseRecordVo> findVoteRecord(FindVoteRecordDto findVoteRecordDto, HttpServletRequest request);

    void recallVote(RecallVoteDto recallVoteDto);

    /**
    * 学生评价报告
    */
    StudentReportVo studentReport(IdRequest idRequest);
    List<StudentReportVo> Reports(ReportDto reportDto);

    void exportStuReportPdf(IdRequest idRequest, HttpServletResponse response) throws IOException, DocumentException;
}
