| 37164 |
amit |
1 |
package com.spice.profitmandi.dao.enumuration.dtr;
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Agenda types tracked as lifecycle instances (user.agenda_instance.agenda_type).
|
| 37181 |
amit |
5 |
* Mirrors {@link VisitAgenda} 1:1 (same names, same labels). Types with an AUTO
|
|
|
6 |
* rule are populated by the nightly cron ONLY — planners cannot assign them
|
|
|
7 |
* manually; only the non-auto types are manual-assignable on Assign Visit.
|
| 37164 |
amit |
8 |
*/
|
|
|
9 |
public enum AgendaType {
|
| 37181 |
amit |
10 |
LOW_INVESTMENT("Low investment", true),
|
|
|
11 |
LOW_SALES("Low sales", true),
|
|
|
12 |
LOW_PURCHASE("Low purchase", true),
|
|
|
13 |
BRAND_ADDITION("Brand addition", false),
|
|
|
14 |
CREDIT_DUES("Credit dues", true),
|
|
|
15 |
SYSTEM_TRAINING("System training", false),
|
|
|
16 |
REVIVAL("Revival", true),
|
|
|
17 |
NEW_STOCK_PAYMENT("New Stock Payment", false);
|
| 37164 |
amit |
18 |
|
|
|
19 |
private final String label;
|
| 37181 |
amit |
20 |
private final boolean hasAutoRule;
|
| 37164 |
amit |
21 |
|
| 37181 |
amit |
22 |
AgendaType(String label, boolean hasAutoRule) {
|
| 37164 |
amit |
23 |
this.label = label;
|
| 37181 |
amit |
24 |
this.hasAutoRule = hasAutoRule;
|
| 37164 |
amit |
25 |
}
|
|
|
26 |
|
|
|
27 |
public String getLabel() {
|
|
|
28 |
return label;
|
|
|
29 |
}
|
|
|
30 |
|
| 37181 |
amit |
31 |
public boolean hasAutoRule() {
|
|
|
32 |
return hasAutoRule;
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
public boolean isManualAssignable() {
|
|
|
36 |
return !hasAutoRule;
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
public static java.util.List<String> manualAssignableLabels() {
|
|
|
40 |
java.util.List<String> out = new java.util.ArrayList<>();
|
|
|
41 |
for (AgendaType t : values()) {
|
|
|
42 |
if (t.isManualAssignable()) out.add(t.label);
|
|
|
43 |
}
|
|
|
44 |
return out;
|
|
|
45 |
}
|
|
|
46 |
|
| 37164 |
amit |
47 |
public static AgendaType fromLabel(String label) {
|
|
|
48 |
if (label == null) return null;
|
|
|
49 |
for (AgendaType t : values()) {
|
|
|
50 |
if (t.label.equalsIgnoreCase(label.trim())) return t;
|
|
|
51 |
}
|
|
|
52 |
return null;
|
|
|
53 |
}
|
|
|
54 |
}
|