[d24f17c] | 1 | package com.example.rezevirajmasa.demo.model;
|
---|
| 2 |
|
---|
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
---|
| 4 | import com.fasterxml.jackson.annotation.JsonManagedReference;
|
---|
| 5 | import jakarta.persistence.*;
|
---|
| 6 |
|
---|
| 7 | import java.math.BigDecimal;
|
---|
| 8 | import java.time.LocalDateTime;
|
---|
| 9 | import java.util.List;
|
---|
| 10 |
|
---|
| 11 | @Entity
|
---|
| 12 | @Table(name = "restaurants")
|
---|
| 13 | public class Restaurant {
|
---|
| 14 | @Id
|
---|
| 15 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 16 | @Column(name = "RestaurantID")
|
---|
| 17 | private Long restaurantId;
|
---|
| 18 |
|
---|
| 19 | @Column(name = "Name", length = 100)
|
---|
| 20 | private String name;
|
---|
| 21 |
|
---|
| 22 | @Column(name = "CuisineType", length = 50)
|
---|
| 23 | private String cuisineType;
|
---|
| 24 |
|
---|
| 25 | @Column(name = "Address", length = 1000)
|
---|
| 26 | private String address;
|
---|
| 27 |
|
---|
| 28 | @Column(name = "Phone", length = 20)
|
---|
| 29 | private String phone;
|
---|
| 30 |
|
---|
| 31 | @Column(name = "OperatingHours", length = 100)
|
---|
| 32 | private String operatingHours;
|
---|
| 33 |
|
---|
| 34 | @Column(name = "Website", length = 100)
|
---|
| 35 | private String website;
|
---|
| 36 |
|
---|
| 37 | @Column(name = "SocialMediaLinks")
|
---|
| 38 | private String socialMediaLinks;
|
---|
| 39 |
|
---|
| 40 | @Column(name = "Rating", precision = 3, scale = 2)
|
---|
| 41 | private BigDecimal rating;
|
---|
| 42 |
|
---|
[2518b3a] | 43 | @JsonManagedReference
|
---|
[deea3c4] | 44 | @OneToMany(mappedBy = "restaurant", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
---|
[d24f17c] | 45 | private List<TableEntity> tablesList;
|
---|
| 46 |
|
---|
| 47 | public Restaurant() {
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | public Restaurant(String name, String cuisineType, String address, String phone, String operatingHours, String website, String socialMediaLinks, BigDecimal rating, List<TableEntity> tablesList) {
|
---|
| 51 | this.name = name;
|
---|
| 52 | this.cuisineType = cuisineType;
|
---|
| 53 | this.address = address;
|
---|
| 54 | this.phone = phone;
|
---|
| 55 | this.operatingHours = operatingHours;
|
---|
| 56 | this.website = website;
|
---|
| 57 | this.socialMediaLinks = socialMediaLinks;
|
---|
| 58 | this.rating = rating;
|
---|
| 59 | this.tablesList = tablesList;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | public String getName() {
|
---|
| 63 | return name;
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | public void setName(String name) {
|
---|
| 67 | this.name = name;
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | public String getCuisineType() {
|
---|
| 71 | return cuisineType;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | public void setCuisineType(String cuisineType) {
|
---|
| 75 | this.cuisineType = cuisineType;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | public String getAddress() {
|
---|
| 79 | return address;
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | public void setAddress(String address) {
|
---|
| 83 | this.address = address;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | public String getPhone() {
|
---|
| 87 | return phone;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | public void setPhone(String phone) {
|
---|
| 91 | this.phone = phone;
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | public String getOperatingHours() {
|
---|
| 95 | return operatingHours;
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | public void setOperatingHours(String operatingHours) {
|
---|
| 99 | this.operatingHours = operatingHours;
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | public String getWebsite() {
|
---|
| 103 | return website;
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | public void setWebsite(String website) {
|
---|
| 107 | this.website = website;
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | public String getSocialMediaLinks() {
|
---|
| 111 | return socialMediaLinks;
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 | public void setSocialMediaLinks(String socialMediaLinks) {
|
---|
| 115 | this.socialMediaLinks = socialMediaLinks;
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 | public BigDecimal getRating() {
|
---|
| 119 | return rating;
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | public void setRating(BigDecimal rating) {
|
---|
| 123 | this.rating = rating;
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 | public List<TableEntity> getTablesList() {
|
---|
| 127 | return tablesList;
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | public void setTablesList(List<TableEntity> tablesList) {
|
---|
| 131 | this.tablesList = tablesList;
|
---|
| 132 | }
|
---|
| 133 |
|
---|
| 134 | public Long getRestaurantId() {
|
---|
| 135 | return restaurantId;
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | public void setRestaurantId(Long restaurantId) {
|
---|
| 139 | this.restaurantId = restaurantId;
|
---|
| 140 | }
|
---|
| 141 |
|
---|
| 142 | @Entity
|
---|
| 143 | @Table(name = "reservation_history")
|
---|
| 144 | public static class ReservationHistory {
|
---|
| 145 |
|
---|
| 146 | @Id
|
---|
| 147 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
[b67dfd3] | 148 | private Long reservationHistoryId;
|
---|
[d24f17c] | 149 |
|
---|
| 150 | @ManyToOne
|
---|
| 151 | @JoinColumn(name = "customer_id")
|
---|
[8ca35dc] | 152 | private User user;
|
---|
[d24f17c] | 153 |
|
---|
| 154 | @ManyToOne
|
---|
| 155 | @JoinColumn(name = "table_id")
|
---|
| 156 | private TableEntity table;
|
---|
| 157 |
|
---|
| 158 | @ManyToOne
|
---|
| 159 | @JoinColumn(name = "restaurant_id")
|
---|
[c44c5ed] | 160 | private Restaurant restaurant;
|
---|
[d24f17c] | 161 |
|
---|
| 162 | @Column(name = "reservation_datetime")
|
---|
| 163 | private LocalDateTime reservationDateTime;
|
---|
| 164 |
|
---|
| 165 | @Column(name = "party_size")
|
---|
| 166 | private int partySize;
|
---|
| 167 |
|
---|
| 168 | @Column(name = "special_requests")
|
---|
| 169 | private String specialRequests;
|
---|
| 170 |
|
---|
| 171 | @Column(name = "status")
|
---|
[b67dfd3] | 172 | private String reservationStatus;
|
---|
[d24f17c] | 173 |
|
---|
| 174 | @Column(name = "cancellation_reason")
|
---|
| 175 | private String cancellationReason;
|
---|
| 176 |
|
---|
[c44c5ed] | 177 | @Column(name = "check_in_date")
|
---|
[d24f17c] | 178 | private LocalDateTime checkInDate;
|
---|
| 179 |
|
---|
[8ca35dc] | 180 | public ReservationHistory(User user, TableEntity table, Restaurant restaurant, LocalDateTime reservationDateTime, int partySize, String specialRequests, String status, String cancellationReason, LocalDateTime checkInDate) {
|
---|
| 181 | this.user = user;
|
---|
[d24f17c] | 182 | this.table = table;
|
---|
| 183 | this.restaurant = restaurant;
|
---|
| 184 | this.reservationDateTime = reservationDateTime;
|
---|
| 185 | this.partySize = partySize;
|
---|
| 186 | this.specialRequests = specialRequests;
|
---|
[b67dfd3] | 187 | this.reservationStatus = status;
|
---|
[d24f17c] | 188 | this.cancellationReason = cancellationReason;
|
---|
| 189 | this.checkInDate = checkInDate;
|
---|
| 190 | }
|
---|
| 191 |
|
---|
| 192 | public ReservationHistory() {
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | public Long getId() {
|
---|
[b67dfd3] | 196 | return reservationHistoryId;
|
---|
[d24f17c] | 197 | }
|
---|
| 198 |
|
---|
| 199 | public void setId(Long id) {
|
---|
[b67dfd3] | 200 | this.reservationHistoryId = id;
|
---|
[d24f17c] | 201 | }
|
---|
| 202 |
|
---|
[8ca35dc] | 203 | public User getUser() {
|
---|
| 204 | return user;
|
---|
[d24f17c] | 205 | }
|
---|
| 206 |
|
---|
[8ca35dc] | 207 | public void setUser(User user) {
|
---|
| 208 | this.user = user;
|
---|
[d24f17c] | 209 | }
|
---|
| 210 |
|
---|
| 211 | public TableEntity getTable() {
|
---|
| 212 | return table;
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | public void setTable(TableEntity table) {
|
---|
| 216 | this.table = table;
|
---|
| 217 | }
|
---|
| 218 |
|
---|
| 219 | public LocalDateTime getReservationDateTime() {
|
---|
| 220 | return reservationDateTime;
|
---|
| 221 | }
|
---|
| 222 |
|
---|
| 223 | public void setReservationDateTime(LocalDateTime reservationDateTime) {
|
---|
| 224 | this.reservationDateTime = reservationDateTime;
|
---|
| 225 | }
|
---|
| 226 |
|
---|
| 227 | public int getPartySize() {
|
---|
| 228 | return partySize;
|
---|
| 229 | }
|
---|
| 230 |
|
---|
| 231 | public void setPartySize(int partySize) {
|
---|
| 232 | this.partySize = partySize;
|
---|
| 233 | }
|
---|
| 234 |
|
---|
| 235 | public String getSpecialRequests() {
|
---|
| 236 | return specialRequests;
|
---|
| 237 | }
|
---|
| 238 |
|
---|
| 239 | public void setSpecialRequests(String specialRequests) {
|
---|
| 240 | this.specialRequests = specialRequests;
|
---|
| 241 | }
|
---|
| 242 |
|
---|
| 243 | public String getStatus() {
|
---|
[b67dfd3] | 244 | return reservationStatus;
|
---|
[d24f17c] | 245 | }
|
---|
| 246 |
|
---|
| 247 | public void setStatus(String status) {
|
---|
[b67dfd3] | 248 | this.reservationStatus = status;
|
---|
[d24f17c] | 249 | }
|
---|
| 250 |
|
---|
| 251 | public String getCancellationReason() {
|
---|
| 252 | return cancellationReason;
|
---|
| 253 | }
|
---|
| 254 |
|
---|
| 255 | public void setCancellationReason(String cancellationReason) {
|
---|
| 256 | this.cancellationReason = cancellationReason;
|
---|
| 257 | }
|
---|
| 258 |
|
---|
| 259 | public Restaurant getRestaurant() {
|
---|
| 260 | return restaurant;
|
---|
| 261 | }
|
---|
| 262 |
|
---|
| 263 | public void setRestaurant(Restaurant restaurant) {
|
---|
| 264 | this.restaurant = restaurant;
|
---|
| 265 | }
|
---|
| 266 |
|
---|
| 267 | public LocalDateTime getCheckInDate() {
|
---|
| 268 | return checkInDate;
|
---|
| 269 | }
|
---|
| 270 |
|
---|
| 271 | public void setCheckInDate(LocalDateTime checkInDate) {
|
---|
| 272 | this.checkInDate = checkInDate;
|
---|
| 273 | }
|
---|
| 274 |
|
---|
| 275 | @Override
|
---|
| 276 | public String toString() {
|
---|
| 277 | return "ReservationHistory{" +
|
---|
[b67dfd3] | 278 | "id=" + reservationHistoryId +
|
---|
[8ca35dc] | 279 | ", user=" + user +
|
---|
[d24f17c] | 280 | ", table=" + table +
|
---|
| 281 | ", restaurant=" + restaurant +
|
---|
| 282 | ", reservationDateTime=" + reservationDateTime +
|
---|
| 283 | ", partySize=" + partySize +
|
---|
| 284 | ", specialRequests='" + specialRequests + '\'' +
|
---|
[b67dfd3] | 285 | ", status='" + reservationStatus + '\'' +
|
---|
[d24f17c] | 286 | ", cancellationReason='" + cancellationReason + '\'' +
|
---|
| 287 | ", checkInDate=" + checkInDate +
|
---|
| 288 | '}';
|
---|
| 289 | }
|
---|
| 290 | }
|
---|
| 291 | }
|
---|