package metier;

import jakarta.persistence.*;
import lombok.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Utilisateur implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;
    private String name;

    @Column(unique=true)
    private String email;
    private String password;

    @ManyToMany
    @JoinTable(
            name="utilisateur_session",
            joinColumns = @JoinColumn(name="utilisateur_id"),
            inverseJoinColumns = @JoinColumn(name = "session_id")
    )
    private List<Session> session= new ArrayList<>();;

    @OneToMany(mappedBy = "utilisateur")
    private List<Quizz> quizzs;
}