package com.betriebsratkanzlei.legalconsenthub.comment;

import com.betriebsratkanzlei.legalconsenthub.application_form.ApplicationForm
import com.betriebsratkanzlei.legalconsenthub.form_element.FormElement
import com.betriebsratkanzlei.legalconsenthub.user.User
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.EntityListeners
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn
import jakarta.persistence.ManyToOne
import org.springframework.data.annotation.CreatedDate
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.time.LocalDateTime

import java.util.UUID;

@Entity
@EntityListeners(AuditingEntityListener::class)
class Comment(
    @Id
    @GeneratedValue
    var id: UUID? = null,

    @Column(nullable = false)
    var message: String = "",

    @ManyToOne
    @JoinColumn(name = "created_by_id", nullable = false)
    var createdBy: User,

    @CreatedDate
    @Column(nullable = false)
    var createdAt: LocalDateTime? = null,

    @LastModifiedDate
    @Column(nullable = false)
    var modifiedAt: LocalDateTime? = null,

    @ManyToOne
    @JoinColumn(name = "application_form_id", nullable = false)
    var applicationForm: ApplicationForm? = null,

    @ManyToOne
    @JoinColumn(name = "form_element_id", nullable = false)
    var formElement: FormElement? = null,
)
