1 /*
2 * MoneyWise: Finance Application
3 * Copyright 2012-2026. Tony Washer
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17 package io.github.tonywasher.joceanus.moneywise.atlas.data.analysis.values;
18
19 import io.github.tonywasher.joceanus.metis.data.MetisDataType;
20 import io.github.tonywasher.joceanus.moneywise.atlas.data.analysis.base.MoneyWiseXAnalysisAttribute;
21
22 /**
23 * AccountAttribute enumeration.
24 */
25 public enum MoneyWiseXAnalysisAccountAttr
26 implements MoneyWiseXAnalysisAttribute {
27 /**
28 * Local Currency Balance.
29 */
30 BALANCE,
31
32 /**
33 * Exchange Rate.
34 */
35 EXCHANGERATE,
36
37 /**
38 * Reported Valuation.
39 */
40 VALUATION,
41
42 /**
43 * Valuation Delta.
44 */
45 VALUEDELTA,
46
47 /**
48 * Deposit Rate.
49 */
50 DEPOSITRATE,
51
52 /**
53 * Maturity.
54 */
55 MATURITY;
56
57 /**
58 * The String name.
59 */
60 private String theName;
61
62 @Override
63 public String toString() {
64 /* If we have not yet loaded the name */
65 if (theName == null) {
66 /* Load the name */
67 theName = MoneyWiseXAnalysisValuesResource.getKeyForAccountAttr(this).getValue();
68 }
69
70 /* return the name */
71 return theName;
72 }
73
74 @Override
75 public boolean isPreserved() {
76 switch (this) {
77 case BALANCE:
78 case MATURITY:
79 case DEPOSITRATE:
80 case EXCHANGERATE:
81 case VALUATION:
82 return true;
83 case VALUEDELTA:
84 default:
85 return false;
86 }
87 }
88
89 @Override
90 public MetisDataType getDataType() {
91 switch (this) {
92 case DEPOSITRATE:
93 return MetisDataType.RATE;
94 case EXCHANGERATE:
95 return MetisDataType.RATIO;
96 case MATURITY:
97 return MetisDataType.DATE;
98 case BALANCE:
99 case VALUATION:
100 case VALUEDELTA:
101 default:
102 return MetisDataType.MONEY;
103 }
104 }
105 }