package com.dora.dto;

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

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

@Data
@Schema(description = "课程详情，包含章节与视频")
public class CourseDetailDto {

	@Schema(description = "课程ID")
	private Long id;

	@Schema(description = "课程标题")
	private String title;

	@Schema(description = "课程描述")
	private String description;

	@Schema(description = "封面图URL")
	private String coverUrl;

	@Schema(description = "详情图集（JSON格式存储多张图片URL）")
	private String detailGallery;

	@Schema(description = "价格")
	private BigDecimal price;

	@Schema(description = "访问级别")
	private Integer level;

	@Schema(description = "分类")
	private String category;

	@Schema(description = "是否免费")
	private Boolean isFree;

	@Schema(description = "创建时间")
	private LocalDateTime createTime;

	@Schema(description = "更新时间")
	private LocalDateTime updateTime;

	@Schema(description = "章节列表")
	private List<ChapterDto> chapters;

	@Schema(description = "创建者信息")
	private CreatorDto creator;

	@Data
	@Schema(description = "章节信息")
	public static class ChapterDto {
		@Schema(description = "章节ID")
		private Long id;
		@Schema(description = "标题")
		private String title;
		@Schema(description = "描述")
		private String description;
		@Schema(description = "排序号")
		private Integer orderNum;
		@Schema(description = "视频列表")
		private List<VideoDto> videos;
	}

	@Data
	@Schema(description = "视频信息")
	public static class VideoDto {
		@Schema(description = "视频条目ID")
		private Long id;
		@Schema(description = "所属章节ID")
		private Long chapterId;
		@Schema(description = "标题")
		private String title;
		@Schema(description = "阿里云点播视频ID（字符串）")
		private String videoId;
		@Schema(description = "时长(秒)")
		private Integer durationSec;
		@Schema(description = "排序号")
		private Integer orderNum;
	}

	@Data
	@Schema(description = "创建者信息")
	public static class CreatorDto {
		@Schema(description = "创建者ID（字符串）")
		private String id;
		@Schema(description = "创建者用户名")
		private String username;
		@Schema(description = "创建者头像URL")
		private String avatarUrl;
	}
}

