source: src/main/java/com/example/rezevirajmasa/demo/model/Reservation.java@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 5.0 KB
Line 
1package com.example.rezevirajmasa.demo.model;
2
3import jakarta.persistence.*;
4
5import java.time.LocalDateTime;
6import java.time.LocalTime;
7
8@Entity
9@Table(name = "reservations")
10public class Reservation {
11
12 @Id
13 @GeneratedValue(strategy = GenerationType.IDENTITY)
14 @Column(name = "ReservationID")
15 private Long reservationID;
16
17 @ManyToOne
18 @JoinColumn(name = "CustomerID")
19 private Customer customer;
20
21 @ManyToOne
22 @JoinColumn(name = "TableNumber", nullable = false)
23 private TableEntity table;
24
25 @ManyToOne
26 @JoinColumn(name = "RestaurantID", nullable = false)
27 private Restaurant restaurant;
28
29 @Column(name = "ReservationDateTime", nullable = false)
30 private LocalDateTime reservationDateTime;
31
32 @Column(name = "PartySize")
33 private int partySize;
34
35 @Column(name = "SpecialRequests")
36 private String specialRequests;
37
38 @Column(name = "Status", length = 20, nullable = false, columnDefinition = "VARCHAR default 'Pending'")
39 private String status;
40
41 @Column(name = "CheckInTime")
42 private LocalDateTime checkInTime;
43
44 @Column(name = "CheckOutTime")
45 private LocalDateTime checkOutTime;
46
47// @Column(name = "TotalAmount", precision = 8, scale = 2)
48// private BigDecimal totalAmount;//rezervacija so depozit ako e
49
50 @Column(name = "Pa`ymentStatus", length = 20, nullable = false, columnDefinition = "VARCHAR default 'Unpaid'")
51 private String paymentStatus;
52
53 public Reservation() {
54
55 }
56
57 // Constructors, getters, setters, and other methods...
58
59 @PrePersist
60 private void prePersist() {
61 // Set default values or perform any pre-persistence logic if needed
62 if (status == null) {
63 status = "Pending";
64 }
65 if (paymentStatus == null) {
66 paymentStatus = "Unpaid";
67 }
68 }
69
70 public Reservation(Customer customer, TableEntity table, Restaurant restaurant, LocalDateTime reservationDateTime, int partySize, String specialRequests, String status, LocalDateTime checkInTime, LocalDateTime checkOutTime, String paymentStatus) {
71// this.customer = customer;
72 this.table = table;
73 this.restaurant = restaurant;
74 this.reservationDateTime = reservationDateTime;
75 this.partySize = partySize;
76 this.specialRequests = specialRequests;
77 this.status = status;
78 this.checkInTime = checkInTime;
79 this.checkOutTime = checkOutTime;
80 this.paymentStatus = paymentStatus;
81 }
82
83 public Long getReservationID() {
84 return reservationID;
85 }
86
87 public void setReservationID(Long reservationID) {
88 this.reservationID = reservationID;
89 }
90
91 public Customer getCustomer() {
92 return customer;
93 }
94
95 public void setCustomer(Customer customer) {
96 this.customer = customer;
97 }
98
99 public TableEntity getTable() {
100 return table;
101 }
102
103 public void setTable(TableEntity table) {
104 this.table = table;
105 }
106
107 public Restaurant getRestaurant() {
108 return restaurant;
109 }
110
111 public void setRestaurant(Restaurant restaurant) {
112 this.restaurant = restaurant;
113 }
114
115 public LocalDateTime getReservationDateTime() {
116 return reservationDateTime;
117 }
118
119 public void setReservationDateTime(LocalDateTime reservationDateTime) {
120 this.reservationDateTime = reservationDateTime;
121 }
122
123 public int getPartySize() {
124 return partySize;
125 }
126
127 public void setPartySize(int partySize) {
128 this.partySize = partySize;
129 }
130
131 public String getSpecialRequests() {
132 return specialRequests;
133 }
134
135 public void setSpecialRequests(String specialRequests) {
136 this.specialRequests = specialRequests;
137 }
138
139 public String getStatus() {
140 return status;
141 }
142
143 public void setStatus(String status) {
144 this.status = status;
145 }
146
147 public LocalDateTime getCheckInTime() {
148 return checkInTime;
149 }
150
151 public void setCheckInTime(LocalDateTime checkInTime) {
152 this.checkInTime = checkInTime;
153 }
154
155 public LocalDateTime getCheckOutTime() {
156 return checkOutTime;
157 }
158
159 public void setCheckOutTime(LocalDateTime checkOutTime) {
160 this.checkOutTime = checkOutTime;
161 }
162
163 public String getPaymentStatus() {
164 return paymentStatus;
165 }
166
167 public void setPaymentStatus(String paymentStatus) {
168 this.paymentStatus = paymentStatus;
169 }
170
171 @Override
172 public String toString() {
173 return "Reservation{" +
174 "reservationID=" + reservationID +
175 ", customer=" + customer +
176 ", table=" + table +
177 ", restaurant=" + restaurant +
178 ", reservationDateTime=" + reservationDateTime +
179 ", partySize=" + partySize +
180 ", specialRequests='" + specialRequests + '\'' +
181 ", status='" + status + '\'' +
182 ", checkInTime=" + checkInTime +
183 ", checkOutTime=" + checkOutTime +
184 ", paymentStatus='" + paymentStatus + '\'' +
185 '}';
186 }
187}
Note: See TracBrowser for help on using the repository browser.