package de.assecutor.votianlt.model;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@Document(collection = "comments")
public class Comment {

    @Id
    private ObjectId id;

    @Field("task_id")
    private ObjectId taskId;

    @Field("comment_text")
    private String commentText;

    @Field("completed_by")
    private String completedBy;

    @Field("created_at")
    private LocalDateTime createdAt;

    public Comment(ObjectId taskId, String commentText, String completedBy) {
        this.taskId = taskId;
        this.commentText = commentText;
        this.completedBy = completedBy;
        this.createdAt = LocalDateTime.now();
    }
}