feat(WHE-18): implement money, billing period, and typed domain ids

This commit is contained in:
2026-03-05 03:57:44 +04:00
parent ac1aa2765c
commit 1fda4bfc14
9 changed files with 632 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
import type { BillingPeriod } from './billing-period'
import type { BillingCycleId, MemberId, PurchaseEntryId } from './ids'
import type { Money } from './money'
export type UtilitySplitMode = 'equal' | 'weighted_by_days'
export interface SettlementMemberInput {
memberId: MemberId
active: boolean
utilityDays?: number
}
export interface SettlementPurchaseInput {
purchaseId: PurchaseEntryId
payerId: MemberId
amount: Money
description?: string
}
export interface SettlementInput {
cycleId: BillingCycleId
period: BillingPeriod
rent: Money
utilities: Money
utilitySplitMode: UtilitySplitMode
members: readonly SettlementMemberInput[]
purchases: readonly SettlementPurchaseInput[]
}
export interface SettlementMemberLine {
memberId: MemberId
rentShare: Money
utilityShare: Money
purchaseOffset: Money
netDue: Money
explanations: readonly string[]
}
export interface SettlementResult {
cycleId: BillingCycleId
period: BillingPeriod
lines: readonly SettlementMemberLine[]
totalDue: Money
}