package com.reading.platform.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.reading.platform.dto.request.LessonCreateRequest;
import com.reading.platform.dto.request.LessonUpdateRequest;
import com.reading.platform.entity.Lesson;
import com.reading.platform.entity.LessonFeedback;
import com.reading.platform.entity.StudentRecord;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * Lesson Service Interface
 */
public interface LessonService {

    Lesson createLesson(String tenantId, LessonCreateRequest request);

    Lesson updateLesson(String id, LessonUpdateRequest request);

    Lesson getLessonById(String id);

    Page<Lesson> getLessonPage(String tenantId, Integer pageNum, Integer pageSize, String classId, String teacherId, String status, LocalDate startDate, LocalDate endDate);

    Page<Lesson> getTeacherLessons(String teacherId, Integer pageNum, Integer pageSize, String status, LocalDate startDate, LocalDate endDate);

    void deleteLesson(String id);

    void startLesson(String id);

    void completeLesson(String id);

    void cancelLesson(String id);

    List<Lesson> getTodayLessons(String tenantId);

    // ==================== 新增方法 ====================

    /**
     * 结束上课
     */
    Lesson finishLesson(String id, Integer actualDuration, String overallRating, String participationRating, String completionNote);

    /**
     * 保存学生评价记录
     */
    StudentRecord saveStudentRecord(String lessonId, String studentId, Integer focus, Integer participation, Integer interest, Integer understanding, String notes);

    /**
     * 获取课程所有学生记录
     */
    List<StudentRecord> getStudentRecords(String lessonId);

    /**
     * 批量保存学生评价记录
     */
    int batchSaveStudentRecords(String lessonId, List<Map<String, Object>> records);

    /**
     * 提交课程反馈
     */
    LessonFeedback saveLessonFeedback(String tenantId, String lessonId, String teacherId, Map<String, Object> feedbackData);

    /**
     * 获取课程反馈
     */
    LessonFeedback getLessonFeedback(String lessonId);

}
