package com.example.projectback.model;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;

@Entity
@Table(name="subject_student")
@IdClass(SubjectStudentId.class)
public class SubjectStudent {
    @Id
    @ManyToOne
    @JsonIgnore
    @JoinColumn(name = "subject_id", referencedColumnName = "id")
    private Subject subject;

    @Id
    @ManyToOne
    @JoinColumn(name = "student_id", referencedColumnName = "id")
    private Student student;

    @Column(name = "payment_confirmed")
    private boolean paymentConfirmed = false;

    public SubjectStudent() {
    }

    public SubjectStudent(Subject subject, Student student) {
        this.subject = subject;
        this.student = student;
    }

    public Subject getSubject() {
        return subject;
    }

    public void setSubject(Subject subject) {
        this.subject = subject;
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    public boolean isPaymentConfirmed() {
        return paymentConfirmed;
    }

    public void setPaymentConfirmed(boolean paymentConfirmed) {
        this.paymentConfirmed = paymentConfirmed;
    }
}
