package com.izouma.jmrh.dto;

import com.izouma.jmrh.domain.Comment;
import com.izouma.jmrh.domain.Message;
import com.izouma.jmrh.domain.Post;
import com.izouma.jmrh.enums.MessageType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class MessageDTO {
    private Long id;

    private Long userId;

    private Long toUserId;

    private String sessionId;

    private String content;

    private MessageType type;

    private boolean read;

    private Long commentId;

    private Long postId;

    private LocalDateTime createdAt;

    private Post post;

    private Comment comment;

    public MessageDTO(Message message, Post post, Comment comment) {
        BeanUtils.copyProperties(message, this);
        this.post = post;
        this.comment = comment;
    }
}
