package cn.reghao.tnb.user.app.model.po;

import cn.reghao.jutil.jdk.db.BaseObject;
import cn.reghao.tnb.user.api.dto.UserMessageDto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * @author reghao
 * @date 2024-03-28 22:11:47
 */
@NoArgsConstructor
@AllArgsConstructor
@Setter
@Getter
public class UserMessage extends BaseObject<Integer> {
    private Integer msgType;
    private Long messageId;
    private String title;
    private String content;
    private Boolean unread;
    private Long userId;
    private LocalDateTime createAt;

    public UserMessage(Long messageId, UserMessageDto userMessageDto) {
        this.messageId = messageId;
        this.title = userMessageDto.getTitle();
        this.content = userMessageDto.getContent();
        this.unread = true;
        this.userId = userMessageDto.getReceiver();
        this.createAt = LocalDateTime.now();
    }
}
