package com.gcc.communityHall.entity; import jakarta.persistence.*; import java.time.LocalDateTime; /** * Audit log table that records every refund-follow-up mail dispatched * for 6-month-old bookings from the /sixmonthold-transactions page. * * DDL (run once): * CREATE TABLE six_month_mail_log ( * id BIGINT AUTO_INCREMENT PRIMARY KEY, * booking_id INT NOT NULL, * booking_status VARCHAR(50), * transaction_id VARCHAR(100), * tpsl_id VARCHAR(100), * refund_amount DOUBLE, * sent_by VARCHAR(100), * sent_at DATETIME DEFAULT CURRENT_TIMESTAMP, * mail_content TEXT * ); * * Also add to booking_details (run once): * ALTER TABLE booking_details * ADD COLUMN mail_sent TINYINT(1) DEFAULT 0, * ADD COLUMN mail_sent_date DATETIME NULL; */ @Entity @Table(name = "six_month_mail_log") public class SixMonthMailLog { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "booking_id", nullable = false) private int bookingId; @Column(name = "booking_status", length = 50) private String bookingStatus; @Column(name = "transaction_id", length = 100) private String transactionId; @Column(name = "tpsl_id", length = 100) private String tpslId; @Column(name = "refund_amount") private Double refundAmount; @Column(name = "sent_by", length = 100) private String sentBy; @Column(name = "sent_at") private LocalDateTime sentAt; @Column(name = "mail_content", columnDefinition = "TEXT") private String mailContent; // ──── Constructors ──────────────────────────────────────────────────────── public SixMonthMailLog() { } public SixMonthMailLog(int bookingId, String bookingStatus, String transactionId, String tpslId, Double refundAmount, String sentBy, String mailContent) { this.bookingId = bookingId; this.bookingStatus = bookingStatus; this.transactionId = transactionId; this.tpslId = tpslId; this.refundAmount = refundAmount; this.sentBy = sentBy; this.sentAt = LocalDateTime.now(); this.mailContent = mailContent; } // ──── Getters & Setters ─────────────────────────────────────────────────── public Long getId() { return id; } public void setId(Long id) { this.id = id; } public int getBookingId() { return bookingId; } public void setBookingId(int bookingId) { this.bookingId = bookingId; } public String getBookingStatus() { return bookingStatus; } public void setBookingStatus(String bookingStatus) { this.bookingStatus = bookingStatus; } public String getTransactionId() { return transactionId; } public void setTransactionId(String transactionId) { this.transactionId = transactionId; } public String getTpslId() { return tpslId; } public void setTpslId(String tpslId) { this.tpslId = tpslId; } public Double getRefundAmount() { return refundAmount; } public void setRefundAmount(Double refundAmount) { this.refundAmount = refundAmount; } public String getSentBy() { return sentBy; } public void setSentBy(String sentBy) { this.sentBy = sentBy; } public LocalDateTime getSentAt() { return sentAt; } public void setSentAt(LocalDateTime sentAt) { this.sentAt = sentAt; } public String getMailContent() { return mailContent; } public void setMailContent(String mailContent) { this.mailContent = mailContent; } }