package ovh.herisson.Clyde.Tables;

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

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

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

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

    public CurriculumCourse(Curriculum curriculum, Course course){
        this.curriculum = curriculum;
        this.course = course;
    }

    public CurriculumCourse() {}

    public int getId() {
        return id;
    }

    public Course getCourse() {
        return course;
    }

    public void setCourse(Course course){
        this.course = course;
    }

    public Curriculum getCurriculum() {
        return curriculum;
    }

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