// Path: src/main/java/edu/ksu/canvas/attendance/enums/Status.java
// public enum Status {
//     PRESENT, TARDY, ABSENT, EXCUSED, NA
// }


import org.hibernate.annotations.Check;
import edu.ksu.canvas.attendance.enums.Status;
import javax.persistence.*;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
package edu.ksu.canvas.attendance.entity;





@Entity
@Table(name = "attendance")
@Check(constraints = "minutes_missed >= 0 and status IN ('PRESENT', 'TARDY', 'ABSENT', 'EXCUSED', 'NA')")
public class Attendance implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(generator = "ATTENDANCE_SEQ", strategy = GenerationType.SEQUENCE)
    @SequenceGenerator(name = "ATTENDANCE_SEQ", sequenceName = "ATTENDANCE_SEQ", allocationSize = 50)
    @Column(name = "attendance_id")
    private Long attendanceId;

    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "student_id", foreignKey = @ForeignKey(name = "fk_student_attendance"))
    private AttendanceStudent attendanceStudent;

    @Column(name = "status")
    @Enumerated(EnumType.STRING)
    private Status status;

    @Column(name = "minutes_missed")
    private Integer minutesMissed;

    @Temporal(TemporalType.DATE)
    @Column(name = "date_of_class")
    private Date dateOfClass;

    @Column(name = "notes")
    private String notes;


    public Attendance() {

    }

// Path: src/main/java/edu/ksu/canvas/attendance/enums/Status.java
// public enum Status {
//     PRESENT, TARDY, ABSENT, EXCUSED, NA
// }


// Path: src/main/java/edu/ksu/canvas/attendance/entity/Attendance.java
import org.hibernate.annotations.Check;
import edu.ksu.canvas.attendance.enums.Status;
import javax.persistence.*;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

package edu.ksu.canvas.attendance.entity;





@Entity
@Table(name = "attendance")
@Check(constraints = "minutes_missed >= 0 and status IN ('PRESENT', 'TARDY', 'ABSENT', 'EXCUSED', 'NA')")
public class Attendance implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(generator = "ATTENDANCE_SEQ", strategy = GenerationType.SEQUENCE)
    @SequenceGenerator(name = "ATTENDANCE_SEQ", sequenceName = "ATTENDANCE_SEQ", allocationSize = 50)
    @Column(name = "attendance_id")
    private Long attendanceId;

    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "student_id", foreignKey = @ForeignKey(name = "fk_student_attendance"))
    private AttendanceStudent attendanceStudent;

    @Column(name = "status")
    @Enumerated(EnumType.STRING)
    private Status status;

    @Column(name = "minutes_missed")
    private Integer minutesMissed;

    @Temporal(TemporalType.DATE)
    @Column(name = "date_of_class")
    private Date dateOfClass;

    @Column(name = "notes")
    private String notes;


    public Attendance() {

    }

    public Attendance(AttendanceStudent attendanceStudent, Status status, Date dateOfClass) {