# LogbookNotificationDTO.java

    package cloud.wconnect.frontoffice.pojo.dto.logbook;

    import lombok.Data;
    import lombok.NoArgsConstructor;
    import org.hibernate.validator.constraints.Length;
    import org.hibernate.validator.constraints.Range;

    import jakarta.validation.Valid;
    import jakarta.validation.constraints.NotBlank;
    import jakarta.validation.constraints.NotNull;
    import java.util.List;

    /**
     * DTO: Logbook Notification
     *
     * @author yyt
     * 2023/3/22
     */
    @Data
    @NoArgsConstructor
    public class LogbookNotificationDTO {

        /**
         * 通知 id
         */
        private Integer id;

        /**
         * category
         */
        @NotNull(message = "the category must not be null")
        private Integer category;

        /**
         * 主题
         */
        @NotNull(message = "the subject must not be null")
        @Length(max = 200, message = "the subject max length is 200")
        private String subject;

        /**
         * 默认主题
         */
        private String defaultSubject;

        /**
         * 通知类型（0：邮件）
         */
        @NotNull(message = "the notifyType must not be blank")
        @Range(min = 0, max = 0, message = "the notifyType must is [0:email]")
        private Integer notifyType;

        /**
         * 需要通知的操作，多个中间逗号隔开（0：created 1:resolved 2：comment）
         */
        @NotBlank(message = "the notifyOperation must not be blank")
        @Length(max = 50, message = "the notifyOperation max length is 50")
        private String notifyOperation;

        /**
         * 用户
         */
        @Valid
        private List<LogbookNotificationTargetDTO> users;

        /**
         * 状态（false：关闭，true：开启）
         */
        @NotNull(message = "the status must not be null")
        private Boolean status;

        public void setSubject(String subject) {
            this.subject = subject.trim();
        }

        public LogbookNotificationDTO(String defaultSubject) {
            this.defaultSubject = defaultSubject;
        }

    }