package ovh.herisson.Clyde.Tables;

import jakarta.persistence.*;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

@Entity
public class UserCurriculum {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;

    //Un étudiant peut avoir plusieurs curriculums
    @ManyToOne(fetch = FetchType.EAGER)
    @OnDelete(action = OnDeleteAction.CASCADE)
    @JoinColumn(name = "Users")
    private User user;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "Curriculum")
    @OnDelete(action = OnDeleteAction.CASCADE)
    private Curriculum curriculum;

    public UserCurriculum(User user, Curriculum curriculum){
        this.user = user;
        this.curriculum = curriculum;
    }

    public UserCurriculum() {}

    public int getId() {
        return id;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Curriculum getCurriculum() {
        return curriculum;
    }

    public void setCurriculum(Curriculum curriculum) {
        this.curriculum = curriculum;
    }
}
