File indexing completed on 2024-05-12 16:42:34

0001 /*
0002     SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef MYMONEYENUMS_H
0007 #define MYMONEYENUMS_H
0008 
0009 #include <QHashFunctions>
0010 
0011 namespace eMyMoney {
0012 /**
0013   * Account types currently supported.
0014   */
0015 namespace Account {
0016 enum class Type {
0017     Unknown = 0,          /**< For error handling */
0018     Checkings,            /**< Standard checking account */
0019     Savings,              /**< Typical savings account */
0020     Cash,                 /**< Denotes a shoe-box or pillowcase stuffed
0021                                  with cash */
0022     CreditCard,           /**< Credit card accounts */
0023     Loan,                 /**< Loan and mortgage accounts (liability) */
0024     CertificateDep,       /**< Certificates of Deposit */
0025     Investment,           /**< Investment account */
0026     MoneyMarket,          /**< Money Market Account */
0027     Asset,                /**< Denotes a generic asset account.*/
0028     Liability,            /**< Denotes a generic liability account.*/
0029     Currency,             /**< Denotes a currency trading account. */
0030     Income,               /**< Denotes an income account */
0031     Expense,              /**< Denotes an expense account */
0032     AssetLoan,            /**< Denotes a loan (asset of the owner of this object) */
0033     Stock,                /**< Denotes an security account as sub-account for an investment */
0034     Equity,               /**< Denotes an equity account e.g. opening/closing balance */
0035 
0036     /* insert new account types above this line */
0037     MaxAccountTypes,      /**< Denotes the number of different account types */
0038 };
0039 inline uint qHash(const Type key, uint seed) {
0040     return ::qHash(static_cast<uint>(key), seed);
0041 }
0042 
0043 enum class Standard {
0044     Liability,
0045     Asset,
0046     Expense,
0047     Income,
0048     Equity,
0049 };
0050 
0051 inline uint qHash(const Standard key, uint seed) {
0052     return ::qHash(static_cast<uint>(key), seed);
0053 }
0054 }
0055 
0056 namespace Payee {
0057 enum class MatchType {
0058     Disabled = 0,
0059     Name,
0060     Key,
0061     NameExact,
0062 };
0063 }
0064 
0065 namespace Security {
0066 enum class Type {
0067     Stock,
0068     MutualFund,
0069     Bond,
0070     Currency,
0071     None,
0072 };
0073 
0074 inline uint qHash(const Type key, uint seed) {
0075     return ::qHash(static_cast<uint>(key), seed);
0076 }
0077 }
0078 
0079 namespace Report {
0080 enum class RowType { NoRows = 0, AssetLiability, ExpenseIncome, Category, TopCategory, Account, Tag, Payee, Month, Week, TopAccount, AccountByTopAccount, EquityType, AccountType, Institution, Budget, BudgetActual, Schedule, AccountInfo, AccountLoanInfo, AccountReconcile, CashFlow, Invalid };
0081 inline uint qHash(const RowType key, uint seed) {
0082     return ::qHash(static_cast<uint>(key), seed);
0083 }
0084 
0085 enum class ColumnType { NoColumns = 0, Days = 1, Months = 1, BiMonths = 2, Quarters = 3, Weeks = 7, Years = 12, Invalid };
0086 inline uint qHash(const ColumnType key, uint seed) {
0087     return ::qHash(static_cast<uint>(key), seed);
0088 }
0089 
0090 enum class ReportType { NoReport = 0, PivotTable, QueryTable, InfoTable, Invalid };
0091 // if you add bits to this bitmask, start with the value currently assigned to QCend and update its value afterwards
0092 // also don't forget to add column names to kQueryColumnsText in mymoneyreport.cpp
0093 enum QueryColumn : int { None = 0x0, Begin = 0x1, Number = 0x1, Payee = 0x2, Category = 0x4, Tag = 0x8, Memo = 0x10, Account = 0x20, Reconciled = 0x40, Action = 0x80, Shares = 0x100, Price = 0x200, Performance = 0x400, Loan = 0x800, Balance = 0x1000, CapitalGain = 0x2000, End = 0x4000 };
0094 
0095 enum class DetailLevel { None = 0, All, Top, Group, Total, End };
0096 inline uint qHash(const DetailLevel key, uint seed) {
0097     return ::qHash(static_cast<uint>(key), seed);
0098 }
0099 
0100 enum class InvestmentSum { Period = 0, OwnedAndSold, Owned, Sold, Bought};
0101 enum class ChartType { None = 0, Line, Bar, Pie, Ring, StackedBar, End };
0102 inline uint qHash(const ChartType key, uint seed) {
0103     return ::qHash(static_cast<uint>(key), seed);
0104 }
0105 
0106 enum class DataLock { Automatic = 0, UserDefined, DataOptionCount };
0107 inline uint qHash(const DataLock key, uint seed) {
0108     return ::qHash(static_cast<uint>(key), seed);
0109 }
0110 enum class ChartPalette { Application = 0, Default, Rainbow, Subdued, End};
0111 inline uint qHash(const ChartPalette key, uint seed) {
0112     return ::qHash(static_cast<uint>(key), seed);
0113 }
0114 }
0115 
0116 namespace Schedule {
0117 /**
0118   * This enum is used to describe all the possible schedule frequencies.
0119   * The special entry, Any, is used to combine all the other types.
0120   */
0121 enum class Occurrence {
0122     Any = 0,
0123     Once = 1,
0124     Daily = 2,
0125     Weekly = 4,
0126     Fortnightly = 8,
0127     EveryOtherWeek = 16,
0128     EveryHalfMonth = 18,
0129     EveryThreeWeeks = 20,
0130     EveryThirtyDays = 30,
0131     Monthly = 32,
0132     EveryFourWeeks = 64,
0133     EveryEightWeeks = 126,
0134     EveryOtherMonth = 128,
0135     EveryThreeMonths = 256,
0136     TwiceYearly = 1024,
0137     EveryOtherYear = 2048,
0138     Quarterly = 4096,
0139     EveryFourMonths = 8192,
0140     Yearly = 16384,
0141 };
0142 
0143 /**
0144   * This enum is used to describe the schedule type.
0145   */
0146 enum class Type {
0147     Any = 0,
0148     Bill = 1,
0149     Deposit = 2,
0150     Transfer = 4,
0151     LoanPayment = 5,
0152 };
0153 
0154 /**
0155   * This enum is used to describe the schedule's payment type.
0156   */
0157 enum class PaymentType {
0158     Any = 0,
0159     DirectDebit = 1,
0160     DirectDeposit = 2,
0161     ManualDeposit = 4,
0162     Other = 8,
0163     WriteChecque = 16,
0164     StandingOrder = 32,
0165     BankTransfer = 64,
0166 };
0167 
0168 /**
0169   * This enum is used by the auto-commit functionality.
0170   *
0171   * Depending upon the value of m_weekendOption the schedule can
0172   * be entered on a different date
0173 **/
0174 enum class WeekendOption {
0175     MoveBefore = 0,
0176     MoveAfter = 1,
0177     MoveNothing = 2,
0178 };
0179 }
0180 
0181 namespace Budget {
0182 enum class Level {
0183     None = 0,
0184     Monthly,
0185     MonthByMonth,
0186     Yearly,
0187     Max,
0188 };
0189 
0190 inline uint qHash(const Level key, uint seed) {
0191     return ::qHash(static_cast<uint>(key), seed);
0192 }
0193 }
0194 
0195 namespace TransactionFilter {
0196 // Make sure to keep the following enum values in sync with the values
0197 // used by the GUI (for KMyMoney in kfindtransactiondlgdecl.ui)
0198 enum class Type {
0199     All = 0,
0200     Payments,
0201     Deposits,
0202     Transfers,
0203     // insert new constants above of this line
0204     LastType,
0205 };
0206 
0207 // Make sure to keep the following enum values in sync with the values
0208 // used by the GUI (for KMyMoney in kfindtransactiondlgdecl.ui)
0209 enum class State {
0210     All = 0,
0211     NotReconciled,
0212     Cleared,
0213     Reconciled,
0214     Frozen,
0215     // insert new constants above of this line
0216     LastState,
0217 };
0218 
0219 // Make sure to keep the following enum values in sync with the values
0220 // used by the GUI (for KMyMoney in kfindtransactiondlgdecl.ui)
0221 enum class Validity {
0222     Any = 0,
0223     Valid,
0224     Invalid,
0225     // insert new constants above of this line
0226     LastValidity,
0227 };
0228 
0229 // Make sure to keep the following enum values in sync with the values
0230 // used by the GUI (for KMyMoney in kfindtransactiondlgdecl.ui)
0231 enum class Date {
0232     All = 0,
0233     AsOfToday,
0234     CurrentMonth,
0235     CurrentYear,
0236     MonthToDate,
0237     YearToDate,
0238     YearToMonth,
0239     LastMonth,
0240     LastYear,
0241     Last7Days,
0242     Last30Days,
0243     Last3Months,
0244     Last6Months,
0245     Last12Months,
0246     Next7Days,
0247     Next30Days,
0248     Next3Months,
0249     Next6Months,
0250     Next12Months,
0251     UserDefined,
0252     Last3ToNext3Months,
0253     Last11Months,
0254     CurrentQuarter,
0255     LastQuarter,
0256     NextQuarter,
0257     CurrentFiscalYear,
0258     LastFiscalYear,
0259     Today,
0260     Next18Months,
0261     // insert new constants above of this line
0262     LastDateItem,
0263 };
0264 inline uint qHash(const Date key, uint seed) {
0265     return ::qHash(static_cast<uint>(key), seed);
0266 }
0267 }
0268 
0269 namespace Split {
0270 /**
0271   * This enum defines the possible reconciliation states a split
0272   * can be in. Possible values are as follows:
0273   *
0274   * @li NotReconciled
0275   * @li Cleared
0276   * @li Reconciled
0277   * @li Frozen
0278   *
0279   * Whenever a new split is created, it has the status NotReconciled. It
0280   * can be set to cleared when the transaction has been performed. Once the
0281   * account is reconciled, cleared splits will be set to Reconciled. The
0282   * state Frozen will be used, when the concept of books is introduced into
0283   * the engine and a split must not be changed anymore.
0284   */
0285 enum class State {
0286     Unknown = -1,
0287     NotReconciled = 0,
0288     Cleared,
0289     Reconciled,
0290     Frozen,
0291     // insert new values above
0292     MaxReconcileState,
0293 };
0294 
0295 enum class InvestmentTransactionType {
0296     UnknownTransactionType = -1,
0297     BuyShares = 0,
0298     SellShares,
0299     Dividend,
0300     ReinvestDividend,
0301     Yield,
0302     AddShares,
0303     RemoveShares,
0304     SplitShares,
0305     InterestIncome,///
0306 };
0307 
0308 inline uint qHash(const InvestmentTransactionType key, uint seed) {
0309     return ::qHash(static_cast<uint>(key), seed);
0310 }
0311 
0312 enum class Action {
0313     Check,
0314     Deposit,
0315     Transfer,
0316     Withdrawal,
0317     ATM,
0318     Amortization,
0319     Interest,
0320     BuyShares,
0321     Dividend,
0322     ReinvestDividend,
0323     Yield,
0324     AddShares,
0325     SplitShares,
0326     InterestIncome,
0327 };
0328 
0329 inline uint qHash(const Action key, uint seed) {
0330     return ::qHash(static_cast<uint>(key), seed);
0331 }
0332 }
0333 
0334 namespace File {
0335 /**
0336   * notificationObject identifies the type of the object
0337   * for which this notification is stored
0338   */
0339 enum class Object {
0340     Account = 1,
0341     Institution,
0342     Payee,
0343     Transaction,
0344     Tag,
0345     Schedule,
0346     Security,
0347     OnlineJob,
0348     CostCenter,
0349 };
0350 
0351 /**
0352   * notificationMode identifies the type of notification
0353   * (add, modify, remove)
0354   */
0355 enum class Mode {
0356     Add = 1,
0357     Modify,
0358     Remove,
0359 };
0360 
0361 }
0362 
0363 /**
0364  * @brief Type of message
0365  *
0366  * An usually it is not easy to categorise log messages. This description is only a hint.
0367  */
0368 namespace OnlineJob {
0369 enum class MessageType {
0370     Debug, /**< Just for debug purposes. In normal scenarios the user should not see this. No need to store this message. Plugins should
0371         not create them at all if debug mode is not enabled. */
0372     Log, /**< A piece of information the user should not see during normal operation. It is not shown in any UI by default. It is stored persistently. */
0373     Information, /**< Information that should be kept but without the need to burden the user. The user can
0374         see this during normal operation. */
0375     Warning, /**< A piece of information the user should see but not be enforced to do so (= no modal dialog). E.g. a task is expected to have
0376         direct effect but instead you have to wait a day (and that is common behavior). */
0377     Error, /**< Important for the user - he must be warned. E.g. a task could unexpectedly not be executed */
0378 };
0379 
0380 /**
0381  * @brief The state of a job given by the onlinePlugin
0382  */
0383 enum class sendingState {
0384     noBankAnswer, /**< Used during or before sending or if sendDate().isValid() the job was successfully sent */
0385     acceptedByBank, /**< bank definitely confirmed the job */
0386     rejectedByBank, /**< bank definitely rejected this job */
0387     abortedByUser, /**< aborted by user during sending */
0388     sendingError, /**< an error occurred, the job is certainly not executed by the bank */
0389 };
0390 }
0391 
0392 namespace Statement {
0393 enum class Type {
0394     None = 0,
0395     Checkings,
0396     Savings,
0397     Investment,
0398     CreditCard,
0399     Invalid,
0400 };
0401 
0402 inline uint qHash(const Type key, uint seed) {
0403     return ::qHash(static_cast<uint>(key), seed);
0404 }
0405 }
0406 
0407 namespace Transaction {
0408 // the following members are only used for investment accounts (m_eType==etInvestment)
0409 // eaNone means the action, shares, and security can be ignored.
0410 enum class Action {
0411     None = 0,
0412     Buy,
0413     Sell,
0414     ReinvestDividend,
0415     CashDividend,
0416     Shrsin,
0417     Shrsout,
0418     Stksplit,
0419     Fees,
0420     Interest,
0421     Invalid,
0422 };
0423 
0424 inline uint qHash(const Action key, uint seed) {
0425     return ::qHash(static_cast<uint>(key), seed);
0426 }
0427 }
0428 
0429 namespace Money {
0430 enum signPosition : int {
0431     // keep those in sync with the ones defined in localeconv
0432     ParensAround = 0,
0433     PreceedQuantityAndSymbol = 1,
0434     SucceedQuantityAndSymbol = 2,
0435     PreceedSymbol = 3,
0436     SucceedSymbol = 4,
0437 };
0438 }
0439 
0440 enum class StockSplitDirection {
0441     StockSplitForward,
0442     StockSplitBackward,
0443 };
0444 }
0445 #endif