Skip to main content

wave_api/
enums.rs

1use serde::{Deserialize, Serialize};
2
3/// Status of an invoice.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
6pub enum InvoiceStatus {
7    Draft,
8    Saved,
9    Sent,
10    Viewed,
11    Overdue,
12    Partial,
13    Paid,
14}
15
16/// Status used when creating or patching an invoice.
17#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
18#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
19pub enum InvoiceCreateStatus {
20    Draft,
21    Saved,
22}
23
24/// How an invoice was sent.
25#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
26#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
27pub enum InvoiceSendMethod {
28    NotSent,
29    WaveSend,
30    ManualMarkSent,
31    Skipped,
32}
33
34/// Type of discount applied to an invoice.
35#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
36#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
37pub enum InvoiceDiscountType {
38    Fixed,
39    Percentage,
40}
41
42/// Sort fields for invoices.
43#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
44#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
45pub enum InvoiceSort {
46    CreatedAtAsc,
47    CreatedAtDesc,
48    ModifiedAtAsc,
49    ModifiedAtDesc,
50    InvoiceDateAsc,
51    InvoiceDateDesc,
52    InvoiceNumberAsc,
53    InvoiceNumberDesc,
54    DueDateAsc,
55    DueDateDesc,
56}
57
58/// Sort fields for customers.
59#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
60#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
61pub enum CustomerSort {
62    CreatedAtAsc,
63    CreatedAtDesc,
64    ModifiedAtAsc,
65    ModifiedAtDesc,
66    NameAsc,
67    NameDesc,
68}
69
70/// Sort fields for products.
71#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
72#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
73pub enum ProductSort {
74    CreatedAtAsc,
75    CreatedAtDesc,
76    ModifiedAtAsc,
77    ModifiedAtDesc,
78    NameAsc,
79    NameDesc,
80}
81
82/// Account type values.
83#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
84#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
85pub enum AccountTypeValue {
86    Asset,
87    Equity,
88    Expense,
89    Income,
90    Liability,
91}
92
93/// Account normal balance type.
94#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
95#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
96pub enum AccountNormalBalanceType {
97    Credit,
98    Debit,
99}
100
101/// Account subtype values.
102#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
103#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
104pub enum AccountSubtypeValue {
105    CashAndBank,
106    CostOfGoodsSold,
107    CreditCard,
108    CustomerPrepaymentsAndCredits,
109    DepreciationAndAmortization,
110    Discounts,
111    DueForPayroll,
112    DueToYouAndOtherOwners,
113    Expense,
114    GainOnForeignExchange,
115    Income,
116    Inventory,
117    Loans,
118    LossOnForeignExchange,
119    MoneyInTransit,
120    NonRetainedEarnings,
121    OtherCurrentAssets,
122    OtherCurrentLiability,
123    OtherIncome,
124    OtherLongTermAssets,
125    OtherLongTermLiability,
126    Payable,
127    PayableBills,
128    PayableOther,
129    PaymentProcessingFees,
130    PayrollExpenses,
131    PropertyPlantEquipment,
132    Receivable,
133    ReceivableInvoices,
134    ReceivableOther,
135    RetainedEarnings,
136    SalesTax,
137    SystemCustomerCredits,
138    Transfers,
139    UncategorizedExpense,
140    UncategorizedIncome,
141    UnknownAccount,
142    VendorPrepaymentsAndCredits,
143}
144
145/// Direction of a transaction anchor.
146#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
147#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
148pub enum TransactionDirection {
149    Deposit,
150    Withdrawal,
151}
152
153/// Balance type for line items.
154#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
155#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
156pub enum BalanceType {
157    Credit,
158    Debit,
159    Decrease,
160    Increase,
161}
162
163/// Origin of a transaction.
164#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
165#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
166pub enum TransactionOrigin {
167    Api,
168}
169
170/// Organizational type of a business.
171#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
172#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
173pub enum OrganizationalType {
174    SoleProprietor,
175    Partnership,
176    Corporation,
177    NonProfit,
178}
179
180/// Currency codes (ISO 4217). Common codes included; the full set is large.
181#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
182pub enum CurrencyCode {
183    USD,
184    CAD,
185    EUR,
186    GBP,
187    AUD,
188    NZD,
189    JPY,
190    CNY,
191    INR,
192    BRL,
193    MXN,
194    CHF,
195    SEK,
196    NOK,
197    DKK,
198    ZAR,
199    HKD,
200    SGD,
201    KRW,
202    TWD,
203    THB,
204    PHP,
205    IDR,
206    MYR,
207    VND,
208    AED,
209    SAR,
210    ILS,
211    TRY,
212    PLN,
213    CZK,
214    HUF,
215    RON,
216    BGN,
217    HRK,
218    RUB,
219    UAH,
220    EGP,
221    NGN,
222    KES,
223    GHS,
224    COP,
225    PEN,
226    ARS,
227    CLP,
228    PKR,
229    BDT,
230    LKR,
231    MMK,
232    NPR,
233    /// Catch-all for codes not listed above.
234    #[serde(untagged)]
235    Other(String),
236}
237
238impl std::fmt::Display for CurrencyCode {
239    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
240        match self {
241            CurrencyCode::Other(s) => write!(f, "{s}"),
242            other => write!(f, "{other:?}"),
243        }
244    }
245}
246
247/// Country codes (ISO 3166-1 alpha-2). Common codes included.
248#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
249pub enum CountryCode {
250    US,
251    CA,
252    GB,
253    AU,
254    NZ,
255    IE,
256    DE,
257    FR,
258    ES,
259    IT,
260    NL,
261    BE,
262    AT,
263    CH,
264    SE,
265    NO,
266    DK,
267    FI,
268    PT,
269    JP,
270    CN,
271    IN,
272    BR,
273    MX,
274    ZA,
275    SG,
276    HK,
277    KR,
278    TW,
279    PH,
280    MY,
281    ID,
282    TH,
283    VN,
284    AE,
285    SA,
286    IL,
287    TR,
288    PL,
289    CZ,
290    HU,
291    RO,
292    BG,
293    HR,
294    RU,
295    UA,
296    EG,
297    NG,
298    KE,
299    GH,
300    CO,
301    PE,
302    AR,
303    CL,
304    PK,
305    BD,
306    LK,
307    NP,
308    /// Catch-all for codes not listed above.
309    #[serde(untagged)]
310    Other(String),
311}
312
313impl std::fmt::Display for CountryCode {
314    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
315        match self {
316            CountryCode::Other(s) => write!(f, "{s}"),
317            other => write!(f, "{other:?}"),
318        }
319    }
320}