package com.weather.modules.sys.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.weather.common.validator.group.AddGroup;
import com.weather.common.validator.group.DefaultGroup;
import com.weather.common.validator.group.UpdateGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 系统通知
 */
@Data
@Schema(title = "系统通知")
public class SysAlertDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(title = "id")
    @Null(message = "{id.null}", groups = AddGroup.class)
    @NotNull(message = "{id.require}", groups = UpdateGroup.class)
    private Long id;

    @Schema(title = "级别: info|warning|danger")
    @NotBlank(message = "通知级别不能为空", groups = DefaultGroup.class)
    private String level;

    @Schema(title = "通知标题")
    @NotBlank(message = "通知标题不能为空", groups = DefaultGroup.class)
    private String title;

    @Schema(title = "通知正文")
    @NotBlank(message = "通知正文不能为空", groups = DefaultGroup.class)
    private String content;

    @Schema(title = "来源类型")
    private String sourceType;

    @Schema(title = "业务关联ID")
    private String sourceId;

    @Schema(title = "过期时间")
    private Date expireTime;

    @Schema(title = "发布时间")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Date publishTime;

    @Schema(title = "创建时间")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Date createDate;

    @Schema(title = "更新时间")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Date updateDate;
}
