1 package com.srv4pos.server.api.sale;
2
3 import com.srv4pos.server.api.infrastructure.Constraints;
4 import com.srv4pos.server.api.infrastructure.SyncEntityInfo;
5 import com.srv4pos.server.api.infrastructure.journal.JournalDate;
6 import com.srv4pos.server.api.validationGroups.IdentifierValidationGroup;
7 import org.springframework.roo.addon.javabean.RooJavaBean;
8 import org.springframework.roo.addon.json.RooJson;
9 import org.springframework.roo.addon.tostring.RooToString;
10
11 import javax.validation.Valid;
12 import javax.validation.constraints.Min;
13 import javax.validation.constraints.NotNull;
14 import javax.validation.constraints.Pattern;
15 import javax.validation.constraints.Size;
16 import java.util.ArrayList;
17 import java.util.Date;
18 import java.util.List;
19
20
21
22
23
24 @RooJavaBean
25 @RooToString
26 @RooJson(deepSerialize = true)
27 public class SaleInfo implements SyncEntityInfo {
28
29
30
31
32 public enum Fields { ID, BRUTTO }
33
34
35
36
37 private long id;
38
39 @NotNull(groups = IdentifierValidationGroup.class)
40 @Size(max = 50, min = 1)
41 @Pattern(regexp = Constraints.WINDOWS_FILENAME_REGEX)
42 private String identifier;
43
44
45
46
47 @NotNull
48 private String sellerIdentifier;
49
50
51
52
53 @NotNull
54 private SaleState saleState;
55
56
57
58
59 private boolean refund;
60
61
62
63
64 private Integer refundFor;
65
66
67
68
69 @Min(0)
70 private long absoluteDiscount;
71
72
73
74
75 @Min(0)
76 private int relativeDiscount;
77
78
79
80
81
82
83 @Min(0)
84 private long vanillaBrutto;
85
86
87
88
89
90
91
92 @Min(0)
93 private long discount;
94
95
96
97
98
99
100 @Min(0)
101 private long brutto;
102
103
104
105
106
107
108 @Min(0)
109 private long vat;
110
111
112
113
114 @Size(max = 20)
115 private String controlUnitId;
116
117
118
119
120 @Size(max = 50, min = 1)
121 @Pattern(regexp = Constraints.WINDOWS_FILENAME_REGEX)
122 private String treasurer;
123
124
125
126
127 @JournalDate
128 private Date close;
129
130
131
132
133 private String day;
134
135 private Integer version;
136
137
138
139
140 @Valid
141 private List<SaleProductInfo> saleProducts = new ArrayList<SaleProductInfo>();
142
143
144
145
146 @Valid
147 private List<PrintInfo> prints = new ArrayList<PrintInfo>();
148
149
150
151
152 @Valid
153 private List<PaymentInfo> payments = new ArrayList<PaymentInfo>();
154
155 @Valid
156 private List<VatRateSumInfo> vatRateSums = new ArrayList<VatRateSumInfo>();
157
158 @Size(max = 50, min = 1)
159 @Pattern(regexp = Constraints.WINDOWS_FILENAME_REGEX)
160 private String tripIdentifier;
161 }