package com.cirle.scientific.questionnaire.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * 问卷问题选项实体类
 */
@Getter
@Setter
@Entity
@Table(name = "questionnaire_question_option")
@SQLDelete(sql = "UPDATE questionnaire_question_option SET deleted = true WHERE id=?")
@Where(clause = "deleted=false")
public class QuestionOptionEntity {

    // ID：实体的唯一标识，不建议用于业务用途
    @Id
    @GeneratedValue(generator = "UUID")
    @GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
    @NotNull
    private String id;

    // 选项所属的问题
    @ManyToOne
    @JoinColumn(name = "question_id")
    @NotNull
    private QuestionEntity questionEntity;

    // 选项标签（通常为A、B、C、D等）
    @NotNull
    private String label;

    // 选项文本
    private String text;

    // 逻辑删除标识（默认值为False）
    @NotNull
    private Boolean deleted = Boolean.FALSE;

}
