Init commit!

This commit is contained in:
Jennie Robinson Faber 2025-08-22 18:36:16 +01:00
commit 086d682592
34 changed files with 19249 additions and 0 deletions

92
app/types/cashflow.ts Normal file
View file

@ -0,0 +1,92 @@
export interface Transaction {
id?: string;
date: Date;
description: string;
amount: number; // Personal portion (after business split) in CAD
totalAmount?: number; // Total original amount in CAD
businessAmount?: number; // Business portion in CAD
businessPercentage?: number; // Percentage attributed to business (0-100)
originalAmount?: number; // Original amount before conversion
originalCurrency?: string; // Original currency (CAD, EUR, etc.)
currency?: string; // Current/display currency (for backward compatibility)
category: string;
type: "recurring" | "one-time";
program?: string;
status?: "actual" | "committed" | "projected";
fundType?: "restricted" | "unrestricted";
frequency?: "weekly" | "biweekly" | "monthly" | "quarterly" | "custom";
customMonths?: number;
endDate?: Date;
probability: number;
isConfirmed: boolean;
isTest?: boolean;
notes?: string;
projectedDate?: Date;
runningBalance?: number;
}
export interface RevenueOpportunity {
_id?: string;
id?: string;
source: string;
amount: number;
probability: number;
targetDate: Date;
stage: string;
notes?: string;
createdAt?: Date;
updatedAt?: Date;
}
export interface CashFlowProjection {
date: Date;
balance: number;
inflow: number;
outflow: number;
netFlow: number;
projectedBalance: number;
}
export interface RunwayScenarios {
conservative: number;
realistic: number;
optimistic: number;
cashOnly: number;
}
export interface CashPosition {
balance: number;
totalInflow: number;
totalOutflow: number;
netFlow: number;
}
export interface TransactionForecast {
month: Date;
recurring: Transaction[];
oneTime: Transaction[];
pipeline: Transaction[];
totalInflow: number;
totalOutflow: number;
runningBalance: number;
}
export interface CombinedCashFlow {
historical: CashFlowProjection[];
projected: CashFlowProjection[];
combined: CashFlowProjection[];
currentBalanceIndex: number;
}
export interface AffordabilityCheck {
canAfford: boolean;
currentAvailable?: number;
newBalance?: number;
currentRunwayWeeks?: number;
newRunwayWeeks?: number;
riskLevel?: string;
recommendation?: string;
reason?: string;
availableAmount?: number;
shortfall?: number;
}