package com.greenorange.promotion.model.dto.course;

import com.greenorange.promotion.annotation.EnumValue;
import com.greenorange.promotion.model.enums.CourseTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Min;
import lombok.Data;

import java.math.BigDecimal;

import java.io.Serial;
import java.io.Serializable;

/**
 * 课程更新请求体
 */
@Data
@Schema(description = "课程更新请求体", requiredProperties = {
                "id",
                "name",
                "type",
                "detail",
                "image",
                "originPrice",
                "discountPrice",
                "orderCount"
})
public class CourseUpdateRequest implements Serializable {

    /**
     * 课程ID
     */
    @Min(value = 1L, message = "课程ID ID不能小于1")
    @Schema(description = "课程ID", example = "1")
    private Long id;

    /**
     * 课程名称
     */
    @NotBlank(message = "课程名称不能为空")
    @Schema(description = "课程名称", example = "数据分析工程师训练营")
    private String name;

    /**
     * 课程类别[考公,财经]
     */
    @NotBlank(message = "课程类别不能为空")
    @EnumValue(enumClass = CourseTypeEnum.class)
    @Schema(description = "课程类别[考公,财经]", example = "自媒体")
    private String type;

    /**
     * 课程概述（富文本）
     */
    @NotBlank(message = "课程概述（富文本）不能为空")
    @Schema(description = "课程概述（富文本）", example = "富文本")
    private String detail;

    /**
     * 课程图片URL
     */
    @NotBlank(message = "课程图片URL不能为空")
    @Schema(description = "课程图片URL", example = "324IEHJDE")
    private String image;

    /**
     * 课程原价
     */
    @DecimalMin(value = "0.0", message = "课程原价不能小于0")
    @Schema(description = "课程原价", example = "3499")
    private BigDecimal originPrice;

    /**
     * 折扣价格
     */
    @DecimalMin(value = "0.0", message = "折扣价格不能小于0")
    @Schema(description = "折扣价格", example = "2499")
    private BigDecimal discountPrice;

    /**
     * 已下单人数
     */
    @Schema(description = "已下单人数", example = "100")
    private Integer orderCount;


    @Serial
    private static final long serialVersionUID = 1L;
}