90 lines
1.9 KiB
Java
90 lines
1.9 KiB
Java
package common.models;
|
|
|
|
import common.enums.TicketType;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
public class Ticket implements Comparable<Ticket> {
|
|
private static long nextId = 1;
|
|
private final long id;
|
|
private String name;
|
|
private Coordinates coordinates;
|
|
private final LocalDate creationDate;
|
|
private Long price;
|
|
private Long discount;
|
|
private TicketType type;
|
|
private Event event;
|
|
|
|
public Ticket(String name, Coordinates coordinates, Long price, Long discount, TicketType type, Event event) {
|
|
this.id = nextId++;
|
|
this.name = name;
|
|
this.coordinates = coordinates;
|
|
this.creationDate = LocalDate.now();
|
|
this.price = price;
|
|
this.discount = discount;
|
|
this.type = type;
|
|
this.event = event;
|
|
}
|
|
|
|
@Override
|
|
public int compareTo(Ticket o) {
|
|
return Long.compare(this.id, o.id);
|
|
}
|
|
|
|
// Геттеры и сеттеры
|
|
public long getId() {
|
|
return id;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public Coordinates getCoordinates() {
|
|
return coordinates;
|
|
}
|
|
|
|
public void setCoordinates(Coordinates coordinates) {
|
|
this.coordinates = coordinates;
|
|
}
|
|
|
|
public LocalDate getCreationDate() {
|
|
return creationDate;
|
|
}
|
|
|
|
public Long getPrice() {
|
|
return price;
|
|
}
|
|
|
|
public void setPrice(Long price) {
|
|
this.price = price;
|
|
}
|
|
|
|
public Long getDiscount() {
|
|
return discount;
|
|
}
|
|
|
|
public void setDiscount(Long discount) {
|
|
this.discount = discount;
|
|
}
|
|
|
|
public TicketType getType() {
|
|
return type;
|
|
}
|
|
|
|
public void setType(TicketType type) {
|
|
this.type = type;
|
|
}
|
|
|
|
public Event getEvent() {
|
|
return event;
|
|
}
|
|
|
|
public void setEvent(Event event) {
|
|
this.event = event;
|
|
}
|
|
} |