package com.snack.server.module.notice.dto.req;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 创建/更新公告请求
 */
@Data
@Schema(description = "创建/更新公告请求")
public class NoticeSaveReq implements Serializable {

    @Schema(description = "公告 ID（更新时必填）")
    private Long id;

    @NotBlank(message = "公告标题不能为空")
    @Size(max = 200, message = "标题最长 200 字")
    @Schema(description = "公告标题", example = "618 大促开始啦")
    private String title;

    @NotBlank(message = "公告内容不能为空")
    @Schema(description = "公告内容（富文本 HTML）")
    private String content;

    @NotNull(message = "公告类型不能为空")
    @Schema(description = "公告类型：0-普通 1-重要 2-活动", example = "2")
    private Integer type;

    @Schema(description = "是否置顶：0-否 1-是", example = "0")
    private Integer isTop = 0;

    @Schema(description = "状态：0-下线 1-上线", example = "1")
    private Integer status = 1;

    @Schema(description = "生效时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    @Schema(description = "失效时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;
}
