package metier;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Quizz implements Serializable {
    @Id
    @GeneratedValue
    private int id;

    @ManyToOne
    private Session session;

    @ManyToOne
    @JoinColumn(name="id_utilisateur")
    private Utilisateur utilisateur;

    @OneToMany(mappedBy = "quizz")
    private List<Question> questions=new ArrayList<Question>();

    public void addQuestion(Question question) {
        this.questions.add(question);
    }
}