package com.rit.ems.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Entity
@Table(name = "ems_attendance")
public class Attendance {
    @Id
    private String id; // format: regId_day_slot

    @Column(name = "registration_id")
    private String registrationId;

    @Column(name = "event_id")
    private Long eventId;

    @Column(name = "day_label")
    private String dayLabel;

    @Column(name = "batch_label")
    private String batchLabel;

    @Column(name = "is_present")
    private Boolean isPresent = false;

    private String date;

    public Attendance() {}

    public Attendance(String id, String registrationId, Long eventId, String dayLabel, String batchLabel, Boolean isPresent, String date) {
        this.id = id;
        this.registrationId = registrationId;
        this.eventId = eventId;
        this.dayLabel = dayLabel;
        this.batchLabel = batchLabel;
        this.isPresent = isPresent;
        this.date = date;
    }

    public String getId() { return id; }
    public void setId(String id) { this.id = id; }

    public String getRegistrationId() { return registrationId; }
    public void setRegistrationId(String registrationId) { this.registrationId = registrationId; }

    public Long getEventId() { return eventId; }
    public void setEventId(Long eventId) { this.eventId = eventId; }

    public String getDayLabel() { return dayLabel; }
    public void setDayLabel(String dayLabel) { this.dayLabel = dayLabel; }

    public String getBatchLabel() { return batchLabel; }
    public void setBatchLabel(String batchLabel) { this.batchLabel = batchLabel; }

    public Boolean getIsPresent() { return isPresent; }
    public void setIsPresent(Boolean isPresent) { this.isPresent = isPresent; }

    public String getDate() { return date; }
    public void setDate(String date) { this.date = date; }

    // Getters and setters to bridge snake_case from frontend
    @JsonProperty("registration_id")
    public String getRegistrationIdSnake() { return registrationId; }
    @JsonProperty("registration_id")
    public void setRegistrationIdSnake(String registrationId) { this.registrationId = registrationId; }

    @JsonProperty("event_id")
    public Long getEventIdSnake() { return eventId; }
    @JsonProperty("event_id")
    public void setEventIdSnake(Long eventId) { this.eventId = eventId; }

    @JsonProperty("day_label")
    public String getDayLabelSnake() { return dayLabel; }
    @JsonProperty("day_label")
    public void setDayLabelSnake(String dayLabel) { this.dayLabel = dayLabel; }

    @JsonProperty("day_idx")
    public String getDayIdx() { return dayLabel; }
    @JsonProperty("day_idx")
    public void setDayIdx(String dayLabel) { this.dayLabel = dayLabel; }

    @JsonProperty("batch_label")
    public String getBatchLabelSnake() { return batchLabel; }
    @JsonProperty("batch_label")
    public void setBatchLabelSnake(String batchLabel) { this.batchLabel = batchLabel; }

    @JsonProperty("batch_idx")
    public String getBatchIdx() { return batchLabel; }
    @JsonProperty("batch_idx")
    public void setBatchIdx(String batchLabel) { this.batchLabel = batchLabel; }

    @JsonProperty("is_present")
    public Boolean getIsPresentSnake() { return isPresent; }
    @JsonProperty("is_present")
    public void setIsPresentSnake(Boolean isPresent) { this.isPresent = isPresent; }
}
