package com.betriebsratkanzlei.legalconsenthub.form_element;

import com.betriebsratkanzlei.legalconsenthub.application_form.ApplicationForm
import com.betriebsratkanzlei.legalconsenthub_api.model.FormElementType
import jakarta.persistence.CollectionTable
import jakarta.persistence.Column
import jakarta.persistence.ElementCollection
import jakarta.persistence.Embeddable
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn
import jakarta.persistence.ManyToOne

import java.util.UUID;

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

    var title: String? = null,

    var description: String? = null,

    @ElementCollection
    @CollectionTable(name = "form_element_options", joinColumns = [JoinColumn(name = "form_element_id")])
    var options: MutableList<FormOption> = mutableListOf(),

    @Column(nullable = false)
    var type: FormElementType,

    @ManyToOne
    @JoinColumn(name = "form_element_section_id", nullable = false)
    var formElementSection: FormElementSection? = null
)
