package models import ( "time" "gorm.io/gorm" ) // Transaction kinds for the ledger. 인센티브 지급 links the accounting side to the // incentive engine so the "가상 포인트 vs 실제 현금" gap can be reconciled. const ( TxnIncome = "income" // 수입 (계약 입금 등) TxnExpense = "expense" // 비용 TxnTax = "tax" // 세금 TxnPayroll = "payroll" // 급여 TxnIncentive = "incentive" // 인센티브 지급 ) // Account is a chart-of-accounts entry (계정과목). type Account struct { Base Code string `json:"code"` Name string `json:"name"` Type string `json:"type"` // income | expense | tax | asset | liability CreatedAt time.Time `json:"createdAt"` } func (m *Account) BeforeCreate(*gorm.DB) error { m.ensureID(); return nil } // Transaction is a single ledger line. Optional ProjectID / MemberEmail tie it to // project profitability and per-member incentive payouts. type Transaction struct { Base Date string `gorm:"index" json:"date"` // YYYY-MM-DD Kind string `gorm:"index" json:"kind"` AccountID *string `json:"accountId"` Amount float64 `json:"amount"` // signed (income +, expense/tax/payroll −) ProjectID *string `gorm:"index" json:"projectId"` MemberEmail *string `json:"memberEmail"` Counterparty string `json:"counterparty"` Memo string `json:"memo"` CreatedBy string `json:"createdBy"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } func (m *Transaction) BeforeCreate(*gorm.DB) error { m.ensureID(); return nil } // TaxRecord captures periodic tax obligations (부가세/원천세 등) for the dashboard. type TaxRecord struct { Base Period string `json:"period"` // YYYY-MM or YYYY-Q Type string `json:"type"` Base_ float64 `gorm:"column:base" json:"base"` Amount float64 `json:"amount"` DueDate string `json:"dueDate"` Paid bool `json:"paid"` Memo string `json:"memo"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } func (m *TaxRecord) BeforeCreate(*gorm.DB) error { m.ensureID(); return nil }