package com.dora.dto;

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

import jakarta.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 课程点赞和收藏相关DTO
 */
public class CourseLikeFavoriteDto {

    @Data
    @Schema(description = "课程点赞请求")
    public static class LikeRequest {
        @NotNull(message = "课程ID不能为空")
        @Schema(description = "课程ID", example = "1")
        private Long courseId;
    }

    @Data
    @Schema(description = "课程收藏请求")
    public static class FavoriteRequest {
        @NotNull(message = "课程ID不能为空")
        @Schema(description = "课程ID", example = "1")
        private Long courseId;
    }

    @Data
    @Schema(description = "点赞响应")
    public static class LikeResponse {
        @Schema(description = "是否成功", example = "true")
        private Boolean success;
        
        @Schema(description = "消息", example = "点赞成功")
        private String message;
        
        @Schema(description = "是否已点赞", example = "true")
        private Boolean isLiked;
        
        @Schema(description = "点赞数量", example = "10")
        private Integer likeCount;
    }

    @Data
    @Schema(description = "收藏响应")
    public static class FavoriteResponse {
        @Schema(description = "是否成功", example = "true")
        private Boolean success;
        
        @Schema(description = "消息", example = "收藏成功")
        private String message;
        
        @Schema(description = "是否已收藏", example = "true")
        private Boolean isFavorited;
        
        @Schema(description = "收藏数量", example = "15")
        private Integer favoriteCount;
    }

    @Data
    @Schema(description = "课程记录")
    public static class CourseRecord {
        @Schema(description = "记录ID", example = "1")
        private Long id;
        
        @Schema(description = "课程ID", example = "1")
        private Long courseId;
        
        @Schema(description = "课程标题", example = "AI图像处理入门课程")
        private String courseTitle;
        
        @Schema(description = "课程描述", example = "学习AI图像处理的基础知识")
        private String courseDescription;
        
        @Schema(description = "封面图URL", example = "https://example.com/cover.jpg")
        private String coverUrl;
        
        @Schema(description = "价格", example = "29.99")
        private BigDecimal price;
        
        @Schema(description = "是否免费", example = "false")
        private Boolean isFree;
        
        @Schema(description = "访问级别", example = "2")
        private Integer level;
        
        @Schema(description = "级别名称", example = "VIP用户")
        private String levelName;
        
        @Schema(description = "分类", example = "人工智能")
        private String category;
        
        @Schema(description = "创建者用户名", example = "teacher01")
        private String creatorUsername;
        
        @Schema(description = "操作时间", example = "2024-01-01T12:00:00")
        private LocalDateTime createTime;
    }

    @Data
    @Schema(description = "课程列表响应")
    public static class CourseListResponse {
        @Schema(description = "是否成功", example = "true")
        private Boolean success;
        
        @Schema(description = "消息", example = "获取成功")
        private String message;
        
        @Schema(description = "课程记录列表")
        private List<CourseRecord> records;
        
        @Schema(description = "总数量", example = "100")
        private Integer total;
        
        @Schema(description = "当前页码", example = "1")
        private Integer page;
        
        @Schema(description = "每页大小", example = "10")
        private Integer size;
    }

    @Data
    @Schema(description = "课程统计响应")
    public static class CourseStatsResponse {
        @Schema(description = "是否成功", example = "true")
        private Boolean success;
        
        @Schema(description = "消息", example = "获取成功")
        private String message;
        
        @Schema(description = "点赞的课程数量", example = "25")
        private Integer likedCourseCount;
        
        @Schema(description = "收藏的课程数量", example = "30")
        private Integer favoritedCourseCount;
    }

    @Data
    @Schema(description = "课程状态响应")
    public static class CourseStatusResponse {
        @Schema(description = "是否成功", example = "true")
        private Boolean success;
        
        @Schema(description = "消息", example = "查询成功")
        private String message;
        
        @Schema(description = "是否已点赞", example = "true")
        private Boolean isLiked;
        
        @Schema(description = "是否已收藏", example = "false")
        private Boolean isFavorited;
        
        @Schema(description = "点赞数量", example = "10")
        private Integer likeCount;
        
        @Schema(description = "收藏数量", example = "15")
        private Integer favoriteCount;
    }
}