package dst.ass1.jpa.model.impl;

import dst.ass1.jpa.model.ICourse;
import dst.ass1.jpa.model.IEnrollmentKey;
import dst.ass1.jpa.model.IParticipant;
import dst.ass1.jpa.util.Constants;

import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.io.Serializable;

@Embeddable
public class EnrollmentKey implements IEnrollmentKey, Serializable {
    @ManyToOne(targetEntity = Participant.class, optional = false)
    @JoinColumn(name = Constants.I_PARTICIPANT)
    private IParticipant participant;

    @ManyToOne(targetEntity = Course.class, optional = false)
    @JoinColumn(name = Constants.I_COURSE)
    private ICourse course;

    @Override
    public IParticipant getParticipant() {
        return participant;
    }

    @Override
    public void setParticipant(IParticipant participant) {
        this.participant = participant;
    }

    @Override
    public ICourse getCourse() {
        return course;
    }

    @Override
    public void setCourse(ICourse course) {
        this.course = course;
    }
}
