package online.wesal.wesal.entity;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import java.time.LocalDateTime;

@Entity
@Table(name = "comments")
public class Comment {
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    @Column(nullable = false, name = "post_id")
    private Long postId;
    
    @Column(nullable = false, name = "creator_id")
    private Long creatorId;
    
    @Column(nullable = false, length = 1000)
    @NotBlank
    private String body;
    
    @Column(nullable = false)
    private LocalDateTime creationDate = LocalDateTime.now();
    
    @Column(name = "reply_comment")
    private Long replyComment;
    
    @Column(name = "display_reply_comment")
    private Long displayReplyComment;
    
    @Column(name = "reply_user")
    private Long replyUser;
    
    @Column(nullable = false)
    private Integer level = 1;
    
    public Comment() {}
    
    public Comment(Long postId, Long creatorId, String body) {
        this.postId = postId;
        this.creatorId = creatorId;
        this.body = body;
        this.level = 1;
    }
    
    public Comment(Long postId, Long creatorId, String body, Long replyComment, Long displayReplyComment, Long replyUser, Integer level) {
        this.postId = postId;
        this.creatorId = creatorId;
        this.body = body;
        this.replyComment = replyComment;
        this.displayReplyComment = displayReplyComment;
        this.replyUser = replyUser;
        this.level = level;
    }
    
    public Long getId() {
        return id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    public Long getPostId() {
        return postId;
    }
    
    public void setPostId(Long postId) {
        this.postId = postId;
    }
    
    public Long getCreatorId() {
        return creatorId;
    }
    
    public void setCreatorId(Long creatorId) {
        this.creatorId = creatorId;
    }
    
    public String getBody() {
        return body;
    }
    
    public void setBody(String body) {
        this.body = body;
    }
    
    public LocalDateTime getCreationDate() {
        return creationDate;
    }
    
    public void setCreationDate(LocalDateTime creationDate) {
        this.creationDate = creationDate;
    }
    
    public Long getReplyComment() {
        return replyComment;
    }
    
    public void setReplyComment(Long replyComment) {
        this.replyComment = replyComment;
    }
    
    public Long getDisplayReplyComment() {
        return displayReplyComment;
    }
    
    public void setDisplayReplyComment(Long displayReplyComment) {
        this.displayReplyComment = displayReplyComment;
    }
    
    public Long getReplyUser() {
        return replyUser;
    }
    
    public void setReplyUser(Long replyUser) {
        this.replyUser = replyUser;
    }
    
    public Integer getLevel() {
        return level;
    }
    
    public void setLevel(Integer level) {
        this.level = level;
    }
}