| 34474 |
aman.kumar |
1 |
package com.spice.profitmandi.dao.entity.scratch;
|
|
|
2 |
|
|
|
3 |
import java.time.LocalDateTime;
|
|
|
4 |
|
|
|
5 |
public class ScratchResponse {
|
|
|
6 |
private int offerId;
|
|
|
7 |
private int scratchOfferId;
|
|
|
8 |
private String offerName;
|
|
|
9 |
private String offerImage;
|
|
|
10 |
private String termsCondition;
|
|
|
11 |
private int giftId;
|
|
|
12 |
private String giftName;
|
|
|
13 |
private String thumbnailUrl;
|
|
|
14 |
private LocalDateTime createdTimestamp;
|
|
|
15 |
private LocalDateTime expiredTimestamp;
|
|
|
16 |
private boolean scratched;
|
|
|
17 |
private int remainingValidityDays;
|
|
|
18 |
private String status;
|
|
|
19 |
|
|
|
20 |
public ScratchResponse() {
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
public ScratchResponse(int offerId, int scratchOfferId, String offerName, String offerImage,
|
|
|
24 |
String termsCondition, int giftId, String giftName,
|
|
|
25 |
String thumbnailUrl, LocalDateTime createdTimestamp,
|
|
|
26 |
LocalDateTime expiredTimestamp, boolean scratched,
|
|
|
27 |
int remainingValidityDays
|
|
|
28 |
) {
|
|
|
29 |
this.offerId = offerId;
|
|
|
30 |
this.scratchOfferId = scratchOfferId;
|
|
|
31 |
this.offerName = offerName;
|
|
|
32 |
this.offerImage = offerImage;
|
|
|
33 |
this.termsCondition = termsCondition;
|
|
|
34 |
this.giftId = giftId;
|
|
|
35 |
this.giftName = giftName;
|
|
|
36 |
this.thumbnailUrl = thumbnailUrl;
|
|
|
37 |
this.createdTimestamp = createdTimestamp;
|
|
|
38 |
this.expiredTimestamp = expiredTimestamp;
|
|
|
39 |
this.scratched = scratched;
|
|
|
40 |
this.remainingValidityDays = remainingValidityDays;
|
|
|
41 |
this.status = calculateStatus();
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
// Helper method to determine display status
|
|
|
45 |
private String calculateStatus() {
|
|
|
46 |
if (createdTimestamp != null && remainingValidityDays == 0 && !scratched) {
|
|
|
47 |
return "EXPIRED";
|
|
|
48 |
}
|
|
|
49 |
if (scratched) {
|
|
|
50 |
return "SCRATCHED";
|
|
|
51 |
}
|
|
|
52 |
return "ACTIVE";
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
// Getters and Setters
|
|
|
56 |
public int getOfferId() {
|
|
|
57 |
return offerId;
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
public void setOfferId(int offerId) {
|
|
|
61 |
this.offerId = offerId;
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
public int getScratchOfferId() {
|
|
|
65 |
return scratchOfferId;
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
public void setScratchOfferId(int scratchOfferId) {
|
|
|
69 |
this.scratchOfferId = scratchOfferId;
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
public String getOfferName() {
|
|
|
73 |
return offerName;
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
public void setOfferName(String offerName) {
|
|
|
77 |
this.offerName = offerName;
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
public String getOfferImage() {
|
|
|
81 |
return offerImage;
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
public void setOfferImage(String offerImage) {
|
|
|
85 |
this.offerImage = offerImage;
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
public String getTermsCondition() {
|
|
|
89 |
return termsCondition;
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
public void setTermsCondition(String termsCondition) {
|
|
|
93 |
this.termsCondition = termsCondition;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
public int getGiftId() {
|
|
|
97 |
return giftId;
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
public void setGiftId(int giftId) {
|
|
|
101 |
this.giftId = giftId;
|
|
|
102 |
}
|
|
|
103 |
|
|
|
104 |
public String getGiftName() {
|
|
|
105 |
return giftName;
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
public void setGiftName(String giftName) {
|
|
|
109 |
this.giftName = giftName;
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
public String getThumbnailUrl() {
|
|
|
113 |
return thumbnailUrl;
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
public void setThumbnailUrl(String thumbnailUrl) {
|
|
|
117 |
this.thumbnailUrl = thumbnailUrl;
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
public LocalDateTime getCreatedTimestamp() {
|
|
|
121 |
return createdTimestamp;
|
|
|
122 |
}
|
|
|
123 |
|
|
|
124 |
public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
|
|
|
125 |
this.createdTimestamp = createdTimestamp;
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
public LocalDateTime getExpiredTimestamp() {
|
|
|
129 |
return expiredTimestamp;
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
public void setExpiredTimestamp(LocalDateTime expiredTimestamp) {
|
|
|
133 |
this.expiredTimestamp = expiredTimestamp;
|
|
|
134 |
this.status = calculateStatus();
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
public boolean isScratched() {
|
|
|
138 |
return scratched;
|
|
|
139 |
}
|
|
|
140 |
|
|
|
141 |
public void setScratched(boolean scratched) {
|
|
|
142 |
this.scratched = scratched;
|
|
|
143 |
this.status = calculateStatus();
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
public int getRemainingValidityDays() {
|
|
|
147 |
return remainingValidityDays;
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
public void setRemainingValidityDays(int remainingValidityDays) {
|
|
|
151 |
this.remainingValidityDays = remainingValidityDays;
|
|
|
152 |
}
|
|
|
153 |
|
|
|
154 |
public String getStatus() {
|
|
|
155 |
return status;
|
|
|
156 |
}
|
|
|
157 |
|
|
|
158 |
@Override
|
|
|
159 |
public String toString() {
|
|
|
160 |
return "ScratchResponse{" +
|
|
|
161 |
"offerId=" + offerId +
|
|
|
162 |
", scratchOfferId='" + scratchOfferId + '\'' +
|
|
|
163 |
", offerName='" + offerName + '\'' +
|
|
|
164 |
", offerImage='" + offerImage + '\'' +
|
|
|
165 |
", termsCondition='" + termsCondition + '\'' +
|
|
|
166 |
", giftId=" + giftId +
|
|
|
167 |
", giftName='" + giftName + '\'' +
|
|
|
168 |
", thumbnailUrl='" + thumbnailUrl + '\'' +
|
|
|
169 |
", createdTimestamp=" + createdTimestamp +
|
|
|
170 |
", expiredTimestamp=" + expiredTimestamp +
|
|
|
171 |
", scratched=" + scratched +
|
|
|
172 |
", remainingValidityDays=" + remainingValidityDays +
|
|
|
173 |
", status='" + status + '\'' +
|
|
|
174 |
'}';
|
|
|
175 |
}
|
|
|
176 |
}
|