package de.itsolutions.ticketsystem.entity; import jakarta.persistence.*; import java.time.LocalDateTime; /** * Represents a ticket in the ticket system. */ @Entity @Table(name = "tickets") public class Ticket { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne(optional = false) @JoinColumn(name = "room_id", nullable = false) private Room room; @Column(nullable = false, name = "title") private String title_en; @Column(nullable = false, name = "titel") private String title_de; @Column(columnDefinition = "TEXT", name = "description") private String description_en; @Column(columnDefinition = "TEXT", name = "beschreibung") private String description_de; @Column(nullable = false) private LocalDateTime createdAt = LocalDateTime.now(); @Column(nullable = false) private String status = "OPEN"; // OPEN, IN_PROGRESS, CLOSED @ManyToOne(optional = false) @JoinColumn(name = "user_id", nullable = false) // Creator (Lehrkraft) private User owner; /** * Gets the ticket ID. * @return The ticket ID. */ public Long getId() { return id; } /** * Sets the ticket ID. * @param id The ticket ID. */ public void setId(Long id) { this.id = id; } /** * Gets the room associated with the ticket. * @return The room. */ public Room getRoom() { return room; } /** * Sets the room for the ticket. * @param room The room. */ public void setRoom(Room room) { this.room = room; } /** * Gets the ticket title. * @return The ticket title. */ public String getTitle() { return title_de; } /** * Sets the ticket title. * @param title The ticket title. */ public void setTitle(String title) { this.title_de = title; this.title_en = title; } /** * Gets the ticket description. * @return The ticket description. */ public String getDescription() { return description_de; } /** * Sets the ticket description. * @param description The ticket description. */ public void setDescription(String description) { this.description_de = description; this.description_en = description; } /** * Gets the creation timestamp of the ticket. * @return The creation timestamp. */ public LocalDateTime getCreatedAt() { return createdAt; } /** * Sets the creation timestamp of the ticket. * @param createdAt The creation timestamp. */ public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; } /** * Gets the status of the ticket. * @return The ticket status. */ public String getStatus() { return status; } /** * Sets the status of the ticket. * @param status The ticket status. */ public void setStatus(String status) { this.status = status; } /** * Gets the owner of the ticket. * @return The ticket owner. */ public User getOwner() { return owner; } /** * Sets the owner of the ticket. * @param owner The ticket owner. */ public void setOwner(User owner) { this.owner = owner; } }