package com.rit.ems.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.persistence.*;

@Entity
@Table(name = "ems_registrations")
public class Registration {
    @Id
    private String id; // format: userId_eventId

    @Column(name = "user_id")
    private Long userId;

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

    @Column(name = "payment_status")
    private String paymentStatus;

    @Column(name = "certification_status")
    private String certificationStatus = "NOT_SUBMITTED";

    @Column(name = "registered_at")
    private String registeredAt;

    @Column(name = "team_code")
    private String teamCode;

    @Column(name = "team_name")
    private String teamName;

    @Column(name = "is_team_leader")
    private Boolean isTeamLeader = false;

    @Column(name = "certification_url", columnDefinition = "TEXT")
    private String certificationUrl;

    @Column(name = "od_url", columnDefinition = "TEXT")
    private String odUrl;

    @Column(name = "ticket_id")
    private String ticketId;

    @Column(name = "ticket_qrcode", columnDefinition = "TEXT")
    private String ticketQrcode;

    // Student profile details captured at registration time
    private String name;
    private String email;
    private String dept;
    private String department;
    private String section;
    private String year;
    
    @Column(name = "reg_no")
    private String regNo;
    
    private String phone;
    private String gender;
    
    @Column(name = "college_name")
    private String collegeName;

    public Registration() {}

    public Registration(String id, Long userId, Long eventId, String paymentStatus, String certificationStatus, String registeredAt, String teamCode, String teamName, Boolean isTeamLeader, String certificationUrl, String odUrl, String ticketId, String ticketQrcode, String name, String email, String dept, String department, String section, String year, String regNo, String phone, String gender, String collegeName) {
        this.id = id;
        this.userId = userId;
        this.eventId = eventId;
        this.paymentStatus = paymentStatus;
        this.certificationStatus = certificationStatus;
        this.registeredAt = registeredAt;
        this.teamCode = teamCode;
        this.teamName = teamName;
        this.isTeamLeader = isTeamLeader;
        this.certificationUrl = certificationUrl;
        this.odUrl = odUrl;
        this.ticketId = ticketId;
        this.ticketQrcode = ticketQrcode;
        this.name = name;
        this.email = email;
        this.dept = dept;
        this.department = department;
        this.section = section;
        this.year = year;
        this.regNo = regNo;
        this.phone = phone;
        this.gender = gender;
        this.collegeName = collegeName;
    }

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

    public Long getUserId() { return userId; }
    public void setUserId(Long userId) { this.userId = userId; }

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

    public String getPaymentStatus() { return paymentStatus; }
    public void setPaymentStatus(String paymentStatus) { this.paymentStatus = paymentStatus; }

    public String getCertificationStatus() { return certificationStatus; }
    public void setCertificationStatus(String certificationStatus) { this.certificationStatus = certificationStatus; }

    public String getRegisteredAt() { return registeredAt; }
    public void setRegisteredAt(String registeredAt) { this.registeredAt = registeredAt; }

    public String getTeamCode() { return teamCode; }
    public void setTeamCode(String teamCode) { this.teamCode = teamCode; }

    public String getTeamName() { return teamName; }
    public void setTeamName(String teamName) { this.teamName = teamName; }

    public Boolean getIsTeamLeader() { return isTeamLeader; }
    public void setIsTeamLeader(Boolean isTeamLeader) { this.isTeamLeader = isTeamLeader; }

    public String getCertificationUrl() { return certificationUrl; }
    public void setCertificationUrl(String certificationUrl) { this.certificationUrl = certificationUrl; }

    public String getOdUrl() { return odUrl; }
    public void setOdUrl(String odUrl) { this.odUrl = odUrl; }

    public String getTicketId() { return ticketId; }
    public void setTicketId(String ticketId) { this.ticketId = ticketId; }

    public String getTicketQrcode() { return ticketQrcode; }
    public void setTicketQrcode(String ticketQrcode) { this.ticketQrcode = ticketQrcode; }

    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public String getEmail() { return email; }
    public void setEmail(String email) { this.email = email; }

    public String getDept() { return dept; }
    public void setDept(String dept) { this.dept = dept; }

    public String getDepartment() { return department; }
    public void setDepartment(String department) { this.department = department; }

    public String getSection() { return section; }
    public void setSection(String section) { this.section = section; }

    public String getYear() { return year; }
    public void setYear(String year) { this.year = year; }

    public String getRegNo() { return regNo; }
    public void setRegNo(String regNo) { this.regNo = regNo; }

    public String getPhone() { return phone; }
    public void setPhone(String phone) { this.phone = phone; }

    public String getGender() { return gender; }
    public void setGender(String gender) { this.gender = gender; }

    public String getCollegeName() { return collegeName; }
    public void setCollegeName(String collegeName) { this.collegeName = collegeName; }

    // Getters and setters to bridge snake_case from frontend
    @JsonProperty("user_id")
    public Long getUserIdSnake() { return userId; }
    @JsonProperty("user_id")
    public void setUserIdSnake(Long userId) { this.userId = userId; }

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

    @JsonProperty("payment_status")
    public String getPaymentStatusSnake() { return paymentStatus; }
    @JsonProperty("payment_status")
    public void setPaymentStatusSnake(String paymentStatus) { this.paymentStatus = paymentStatus; }

    @JsonProperty("certification_status")
    public String getCertificationStatusSnake() { return certificationStatus; }
    @JsonProperty("certification_status")
    public void setCertificationStatusSnake(String certificationStatus) { this.certificationStatus = certificationStatus; }

    @JsonProperty("registered_at")
    public String getRegisteredAtSnake() { return registeredAt; }
    @JsonProperty("registered_at")
    public void setRegisteredAtSnake(String registeredAt) { this.registeredAt = registeredAt; }

    @JsonProperty("team_code")
    public String getTeamCodeSnake() { return teamCode; }
    @JsonProperty("team_code")
    public void setTeamCodeSnake(String teamCode) { this.teamCode = teamCode; }

    @JsonProperty("team_name")
    public String getTeamNameSnake() { return teamName; }
    @JsonProperty("team_name")
    public void setTeamNameSnake(String teamName) { this.teamName = teamName; }

    @JsonProperty("is_team_leader")
    public Boolean getIsTeamLeaderSnake() { return isTeamLeader; }
    @JsonProperty("is_team_leader")
    public void setIsTeamLeaderSnake(Boolean isTeamLeader) { this.isTeamLeader = isTeamLeader; }

    @JsonProperty("certification_url")
    public String getCertificationUrlSnake() { return certificationUrl; }
    @JsonProperty("certification_url")
    public void setCertificationUrlSnake(String certificationUrl) { this.certificationUrl = certificationUrl; }

    @JsonProperty("od_url")
    public String getOdUrlSnake() { return odUrl; }
    @JsonProperty("od_url")
    public void setOdUrlSnake(String odUrl) { this.odUrl = odUrl; }

    @JsonProperty("ticket_id")
    public String getTicketIdSnake() { return ticketId; }
    @JsonProperty("ticket_id")
    public void setTicketIdSnake(String ticketId) { this.ticketId = ticketId; }

    @JsonProperty("ticket_qrcode")
    public String getTicketQrcodeSnake() { return ticketQrcode; }
    @JsonProperty("ticket_qrcode")
    public void setTicketQrcodeSnake(String ticketQrcode) { this.ticketQrcode = ticketQrcode; }
}
