Files
finance-duck/internal/domain/model.go
T
2026-09-10 12:30:42 +02:00

75 lines
2.6 KiB
Go

package domain
// Money is an exact decimal string bounded to signed 64-bit ten-thousandths.
type Money string
type Account struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Institution string `json:"institution"`
Currency string `json:"currency"`
ExternalAccountID string `json:"external_account_id,omitempty"`
IBAN string `json:"iban,omitempty"`
Active bool `json:"active"`
}
type Facts struct {
ID string `json:"id"`
Source string `json:"source"`
AccountID string `json:"account_id"`
BookingDate string `json:"booking_date"`
ValueDate string `json:"value_date,omitempty"`
Amount Money `json:"amount"`
Currency string `json:"currency"`
RawDescription string `json:"raw_description"`
ExternalID string `json:"external_id,omitempty"`
Fingerprint string `json:"fingerprint"`
Counterparty string `json:"counterparty,omitempty"`
CounterpartyIBAN string `json:"counterparty_iban,omitempty"`
}
type Provenance struct {
Source string `json:"source"`
Model string `json:"model,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
Error string `json:"error,omitempty"`
}
type Enrichment struct {
Kind string `json:"kind"`
MerchantID string `json:"merchant_id,omitempty"`
CategoryID string `json:"category_id,omitempty"`
TagIDs []string `json:"tag_ids"`
TransferPeerID string `json:"transfer_peer_id,omitempty"`
Classification Provenance `json:"classification"`
}
type Transaction struct {
Facts Facts `json:"facts"`
Enrichment Enrichment `json:"enrichment"`
}
type Category struct {
ID string `json:"id"`
Name string `json:"name"`
ParentID string `json:"parent_id,omitempty"`
Kind string `json:"kind"`
}
type Tag struct {
ID string `json:"id"`
Name string `json:"name"`
}
type Merchant struct {
ID string `json:"id"`
Name string `json:"name"`
Aliases []string `json:"aliases"`
DefaultCategoryID string `json:"default_category_id,omitempty"`
DefaultTagIDs []string `json:"default_tag_ids"`
UseDefaults bool `json:"use_defaults"`
}
type Dataset struct {
Accounts []Account `json:"accounts"`
Categories []Category `json:"categories"`
Tags []Tag `json:"tags"`
Merchants []Merchant `json:"merchants"`
Transactions []Transaction `json:"transactions"`
}
const ExpenseFallback = "cat_expenses_unclassified"
const IncomeFallback = "cat_income_unclassified"