package com.davos.assessment.assessment;

import com.davos.assessment.user.AppUser;
import com.davos.assessment.project.Project;
import jakarta.persistence.*;
import java.time.Instant;

@Entity
@Table(name = "submissions")
public class Submission {
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private Long id;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "user_id", nullable = false)
  private AppUser user;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "project_id", nullable = false)
  private Project project;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "assessment_id", nullable = false)
  private Assessment assessment;

  @Column(name = "raw_score", nullable = false)
  private int rawScore;

  @Column(nullable = false)
  private String level;

  @Column(name = "dimension_scores", nullable = false, columnDefinition = "text")
  private String dimensionScores;

  @Column(name = "submitted_at", nullable = false)
  private Instant submittedAt = Instant.now();

  public Long getId() { return id; }
  public Project getProject() { return project; }
  public void setProject(Project project) { this.project = project; }
  public AppUser getUser() { return user; }
  public void setUser(AppUser user) { this.user = user; }
  public Assessment getAssessment() { return assessment; }
  public void setAssessment(Assessment assessment) { this.assessment = assessment; }
  public int getRawScore() { return rawScore; }
  public void setRawScore(int rawScore) { this.rawScore = rawScore; }
  public String getLevel() { return level; }
  public void setLevel(String level) { this.level = level; }
  public String getDimensionScores() { return dimensionScores; }
  public void setDimensionScores(String dimensionScores) { this.dimensionScores = dimensionScores; }
  public Instant getSubmittedAt() { return submittedAt; }
  public void setSubmittedAt(Instant submittedAt) { this.submittedAt = submittedAt; }
}
