package com.yaoyuan.jiscuss.entity;

import jakarta.persistence.*;
import lombok.Data;

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

@Data
@Entity
@Table(name = "notification")
public class Notification implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /** Receiver user ID. */
    @Column(name = "user_id", nullable = false)
    private Integer userId;

    /** Sender user ID (null for system notifications). */
    @Column(name = "from_user_id")
    private Integer fromUserId;

    /** Notification type: reply / like / system. */
    @Column(name = "type", nullable = false)
    private String type;

    @Column(name = "title")
    private String title;

    @Column(name = "content", columnDefinition = "TEXT")
    private String content;

    /** Related entity ID (e.g., discussion or post id). */
    @Column(name = "related_id")
    private Integer relatedId;

    /** Type of related entity: discussion / post. */
    @Column(name = "related_type")
    private String relatedType;

    @Column(name = "is_read")
    private Boolean isRead = false;

    @Column(name = "create_time")
    private Date createTime;
}
