package com.betriebsratkanzlei.legalconsenthub.form_element;

import com.betriebsratkanzlei.legalconsenthub.application_form.ApplicationForm
import jakarta.persistence.CascadeType
import jakarta.persistence.CollectionTable
import jakarta.persistence.Column
import jakarta.persistence.ElementCollection
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn
import jakarta.persistence.ManyToOne
import jakarta.persistence.OneToMany

import java.util.UUID;

@Entity
class FormElementSection(
    @Id
    @GeneratedValue
    var id: UUID? = null,

    @Column(nullable = false)
    var title: String,

    var shortTitle: String? = null,

    var description: String? = null,

    @OneToMany(mappedBy = "formElementSection", cascade = [CascadeType.ALL], orphanRemoval = true)
    var formElements: MutableList<FormElement> = mutableListOf(),

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