package ovh.herisson.Clyde.Tables;

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

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

    @ManyToOne
    @JoinColumn(name = "Users")
    @OnDelete(action = OnDeleteAction.CASCADE)
    private User user;

    @ManyToOne
    @JoinColumn(name = "Curriculum")
    @OnDelete(action = OnDeleteAction.CASCADE)
    private Curriculum newCurriculum;
    private RequestState state;

    //Permet de différencier les demandes de changement et une réinscription dans le même Curriculum
    //Pour la réinscription on va le mettre a 0
    private boolean type = false;

    public ReInscriptionRequest(){}

    public ReInscriptionRequest(User user, Curriculum newCurriculum, RequestState state, boolean type){
        this.user = user;
        this.newCurriculum = newCurriculum;
        this.state = state;
        this.type = type;
    }

    public ReInscriptionRequest(User user, Curriculum newCurriculum, RequestState state){
        this.user = user;
        this.newCurriculum = newCurriculum;
        this.state = state;
    }

    public int getId() {
        return id;
    }

    public User getUser() {
        return user;
    }

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

    public Curriculum getNewCurriculum() {
        return newCurriculum;
    }

    public void setNewCurriculum(Curriculum newCurriculum) {
        this.newCurriculum = newCurriculum;
    }

    public RequestState getState() {
        return state;
    }

    public void setState(RequestState state) {
        this.state = state;
    }

    public boolean isType() {
        return type;
    }

    public void setType(boolean type) {
        this.type = type;
    }
}
