package com.davos.assessment.report;

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

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

  @OneToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "submission_id", nullable = false, unique = true)
  private Submission submission;

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

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

  @Column(nullable = false, columnDefinition = "text")
  private String summary;

  @Column(nullable = false, columnDefinition = "text")
  private String suggestions;

  @Column(name = "created_at", nullable = false)
  private Instant createdAt = Instant.now();

  public Long getId() { return id; }
  public Project getProject() { return project; }
  public void setProject(Project project) { this.project = project; }
  public Submission getSubmission() { return submission; }
  public void setSubmission(Submission submission) { this.submission = submission; }
  public AppUser getUser() { return user; }
  public void setUser(AppUser user) { this.user = user; }
  public String getSummary() { return summary; }
  public void setSummary(String summary) { this.summary = summary; }
  public String getSuggestions() { return suggestions; }
  public void setSuggestions(String suggestions) { this.suggestions = suggestions; }
  public Instant getCreatedAt() { return createdAt; }
}
