1 | package com.example.moviezone.model;
|
---|
2 |
|
---|
3 | import javax.persistence.*;
|
---|
4 | import lombok.Getter;
|
---|
5 | import lombok.Setter;
|
---|
6 | import lombok.ToString;
|
---|
7 |
|
---|
8 | import java.math.BigInteger;
|
---|
9 | import java.time.LocalDate;
|
---|
10 | import java.time.LocalDateTime;
|
---|
11 |
|
---|
12 | @Entity
|
---|
13 | @Getter
|
---|
14 | @Setter
|
---|
15 | @ToString
|
---|
16 | @Table(name = "tickets")
|
---|
17 | public class Ticket {
|
---|
18 |
|
---|
19 | @Id
|
---|
20 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
21 | int id_ticket;
|
---|
22 |
|
---|
23 | long price;
|
---|
24 | LocalDate date_reserved;
|
---|
25 |
|
---|
26 | @ManyToOne
|
---|
27 | @JoinColumn(name = "id_customer")
|
---|
28 | Customer customer;
|
---|
29 | @ManyToOne
|
---|
30 | @JoinColumn(name = "id_projection")
|
---|
31 | Projection projection;
|
---|
32 | @ManyToOne
|
---|
33 | @JoinColumn(name = "id_discount")
|
---|
34 | Discount discount;
|
---|
35 | @ManyToOne
|
---|
36 | @JoinColumn(name = "id_seat")
|
---|
37 | Seat seat;
|
---|
38 |
|
---|
39 | public Ticket(long price, Customer customer) {
|
---|
40 | this.price = price;
|
---|
41 | this.customer = customer;
|
---|
42 | this.date_reserved=LocalDate.now();
|
---|
43 | }
|
---|
44 |
|
---|
45 | public Ticket(LocalDate date_reserved, Customer customer, Projection projection, Seat seat) {
|
---|
46 | this.date_reserved = date_reserved;
|
---|
47 | this.customer = customer;
|
---|
48 | this.projection = projection;
|
---|
49 | this.seat = seat;
|
---|
50 | }
|
---|
51 |
|
---|
52 | public Ticket( LocalDate date_reserved, Customer customer, Projection projection, Discount discount, Seat seat) {
|
---|
53 | this.date_reserved = date_reserved;
|
---|
54 | this.customer = customer;
|
---|
55 | this.projection = projection;
|
---|
56 | this.discount = discount;
|
---|
57 | this.seat = seat;
|
---|
58 | }
|
---|
59 |
|
---|
60 | public Ticket() {
|
---|
61 |
|
---|
62 | }
|
---|
63 |
|
---|
64 | public void setPrice(long price) {
|
---|
65 | this.price = price;
|
---|
66 | }
|
---|
67 | }
|
---|