package com.lesingle.edu.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;

/**
 * 课程包数据统计响应
 * 用于超管端「数据统计」页面
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "课程包数据统计响应")
public class CoursePackageStatsResponse {

    @Schema(description = "课程包名称")
    private String courseName;

    @Schema(description = "总授课次数")
    private Integer totalLessons;

    @Schema(description = "参与教师数")
    private Integer totalTeachers;

    @Schema(description = "参与学生数")
    private Integer totalStudents;

    @Schema(description = "平均评分")
    private BigDecimal avgRating;

    @Schema(description = "授课记录趋势 [{date, count}]")
    private List<LessonTrendItem> lessonTrend;

    @Schema(description = "教师反馈分布")
    private FeedbackDistribution feedbackDistribution;

    @Schema(description = "最近授课记录")
    private List<RecentLessonItem> recentLessons;

    @Schema(description = "学生表现统计")
    private StudentPerformance studentPerformance;

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class LessonTrendItem {
        private String date;
        private Integer count;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class FeedbackDistribution {
        private BigDecimal designQuality;
        private BigDecimal participation;
        private BigDecimal goalAchievement;
        private Integer totalFeedbacks;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class RecentLessonItem {
        private TeacherInfo teacher;
        @com.fasterxml.jackson.annotation.JsonProperty("class")
        private ClassInfo classInfo;
        private String startDatetime;
        private Integer actualDuration;
        private Integer duration;
        private String status;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class TeacherInfo {
        private Long id;
        private String name;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class ClassInfo {
        private Long id;
        private String name;
    }

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class StudentPerformance {
        private BigDecimal avgFocus;
        private BigDecimal avgParticipation;
        private BigDecimal avgInterest;
        private BigDecimal avgUnderstanding;
    }
}
