1 /***************************************************************************
2  * SPDX-FileCopyrightText: 2021 S. MANKOWSKI stephane@mankowski.fr
3  * SPDX-FileCopyrightText: 2021 G. DE BURE support@mankowski.fr
4  * SPDX-License-Identifier: GPL-3.0-or-later
5  ***************************************************************************/
6 #ifndef SKGBANKOBJECT_H
7 #define SKGBANKOBJECT_H
8 /** @file
9  * This file defines classes SKGBankObject.
10  *
11  * @author Stephane MANKOWSKI / Guillaume DE BURE
12  */
13 
14 #include "skgbankmodeler_export.h"
15 #include "skgnamedobject.h"
16 
17 class SKGAccountObject;
18 /**
19  * This class manages bank object
20  */
21 class SKGBANKMODELER_EXPORT SKGBankObject final : public SKGNamedObject
22 {
23 public:
24     /**
25      * Default constructor
26      */
27     explicit SKGBankObject();
28 
29     /**
30      * Constructor
31      * @param iDocument the document containing the object
32      * @param iID the identifier in @p iTable of the object
33      */
34     explicit SKGBankObject(SKGDocument* iDocument, int iID = 0);
35 
36     /**
37      * Copy constructor
38      * @param iObject the object to copy
39      */
40     SKGBankObject(const SKGBankObject& iObject);
41 
42     /**
43      * Copy constructor
44      * @param iObject the object to copy
45      */
46     explicit SKGBankObject(const SKGNamedObject& iObject);
47 
48     /**
49      * Copy constructor
50      * @param iObject the object to copy
51      */
52     explicit SKGBankObject(const SKGObjectBase& iObject);
53 
54     /**
55      * Operator affectation
56      * @param iObject the object to copy
57      */
58     SKGBankObject& operator= (const SKGObjectBase& iObject);
59 
60     /**
61      * Operator affectation
62      * @param iObject the object to copy
63      */
64     SKGBankObject& operator= (const SKGBankObject& iObject);
65 
66     /**
67      * Destructor
68      */
69     virtual ~SKGBankObject();
70 
71     /**
72      * Add an account
73      * @param oAccount the created account
74      * @return an object managing the error.
75      *   @see SKGError
76      */
77     SKGError addAccount(SKGAccountObject& oAccount);
78 
79     /**
80      * Get accounts
81      * @param oAccountList the list of accounts in this bank
82      * @return an object managing the error
83      *   @see SKGError
84      */
85     SKGError getAccounts(SKGListSKGObjectBase& oAccountList) const;
86 
87     /**
88      * Set the number of the bank
89      * @param iNumber the number
90      * @return an object managing the error
91      *   @see SKGError
92      */
93     SKGError setNumber(const QString& iNumber);
94 
95     /**
96      * Get the number of the bank
97      * @return the number
98      */
99     QString getNumber() const;
100 
101     /**
102      * Set the icon of the bank
103      * @param iIcon the icon
104      * @return an object managing the error
105      *   @see SKGError
106      */
107     SKGError setIcon(const QString& iIcon);
108 
109     /**
110      * Get the icon of the bank
111      * @return the number
112      */
113     QString getIcon() const;
114 
115     /**
116      * Get the current amount
117      * @return the current amount
118      */
119     double getCurrentAmount() const;
120 };
121 /**
122  * Declare the class
123  */
124 Q_DECLARE_TYPEINFO(SKGBankObject, Q_MOVABLE_TYPE);
125 
126 #endif
127