]> WPIA git - gigi.git/blob - src/club/wpia/gigi/dbObjects/Assurance.java
upd: rename package name and all references to it
[gigi.git] / src / club / wpia / gigi / dbObjects / Assurance.java
1 package club.wpia.gigi.dbObjects;
2
3 import java.util.Date;
4
5 import club.wpia.gigi.database.DBEnum;
6 import club.wpia.gigi.dbObjects.wrappers.DataContainer;
7
8 @DataContainer
9 public class Assurance {
10
11     public enum AssuranceType implements DBEnum {
12         FACE_TO_FACE("Face to Face Meeting"), TOPUP("TOPUP"), TTP_ASSISTED("TTP-Assisted"), NUCLEUS("Nucleus Bonus");
13
14         private final String description;
15
16         private AssuranceType(String description) {
17             this.description = description;
18         }
19
20         public String getDescription() {
21             return description;
22         }
23
24         @Override
25         public String getDBName() {
26             return description;
27         }
28     }
29
30     private int id;
31
32     private User from;
33
34     private Name to;
35
36     private String location;
37
38     private String method;
39
40     private int points;
41
42     private String date;
43
44     private Country country;
45
46     private Date expireDate;
47
48     public Assurance(int id, User from, Name to, String location, String method, int points, String date, Country country, Date expireDate) {
49         this.id = id;
50         this.from = from;
51         this.to = to;
52         this.location = location;
53         this.method = method;
54         this.points = points;
55         this.date = date;
56         this.country = country;
57         this.expireDate = expireDate;
58     }
59
60     public User getFrom() {
61         return from;
62     }
63
64     public int getId() {
65         return id;
66     }
67
68     public String getLocation() {
69         return location;
70     }
71
72     public int getPoints() {
73         return points;
74     }
75
76     public Name getTo() {
77         return to;
78     }
79
80     public String getMethod() {
81         return method;
82     }
83
84     public String getDate() {
85         return date;
86     }
87
88     public Country getCountry() {
89         return country;
90     }
91
92     public Date getExpireDate() {
93         return expireDate;
94     }
95
96     public boolean isExpired() {
97         boolean expired = false;
98         if (expireDate == null) {
99             expired = false;
100         } else {
101             Date now = new Date();
102             expired = expireDate.before(now);
103         }
104         return expired;
105     }
106 }