namespace PowderCoating.Application.DTOs.AI; // ── Shared ──────────────────────────────────────────────────────────────────── /// Lightweight account summary passed to AI for account matching. public class AccountSummary { public int Id { get; set; } public string AccountNumber { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; public string AccountType { get; set; } = string.Empty; // "Expense", "CostOfGoods", "Asset" public string? AccountSubType { get; set; } } // ── Feature 1: Receipt / Bill Scanning ─────────────────────────────────────── public class ScannedLineItem { public string Description { get; set; } = string.Empty; public decimal Amount { get; set; } public int? SuggestedAccountId { get; set; } public string? SuggestedAccountName { get; set; } } public class ReceiptScanResult { public bool Success { get; set; } public string? ErrorMessage { get; set; } public string? VendorName { get; set; } public string? Date { get; set; } // ISO 8601 date string public decimal? Total { get; set; } public string? InvoiceNumber { get; set; } public List LineItems { get; set; } = new(); } /// Internal JSON schema that Claude returns for receipt scans. public class ClaudeReceiptResponse { public string? VendorName { get; set; } public string? Date { get; set; } public decimal? Total { get; set; } public string? InvoiceNumber { get; set; } public List LineItems { get; set; } = new(); } public class ClaudeReceiptLineItem { public string Description { get; set; } = string.Empty; public decimal Amount { get; set; } public int? SuggestedAccountId { get; set; } public string? SuggestedAccountName { get; set; } } // ── Feature 2: AR Follow-up Email Drafts ───────────────────────────────────── public class OverdueInvoice { public string InvoiceNumber { get; set; } = string.Empty; public decimal Amount { get; set; } public int DaysOverdue { get; set; } } public class ArFollowUpRequest { public string CustomerName { get; set; } = string.Empty; public string CompanyName { get; set; } = string.Empty; public decimal AmountOwed { get; set; } public int DaysOverdue { get; set; } public List Invoices { get; set; } = new(); } public class ArFollowUpResult { public bool Success { get; set; } public string? ErrorMessage { get; set; } public string Subject { get; set; } = string.Empty; public string Body { get; set; } = string.Empty; } /// Internal JSON schema that Claude returns for AR email drafts. public class ClaudeArEmailResponse { public string Subject { get; set; } = string.Empty; public string Body { get; set; } = string.Empty; } // ── Feature 3: Smart Account Categorization ────────────────────────────────── public class AccountSuggestionRequest { public string? VendorName { get; set; } public string? Description { get; set; } public decimal Amount { get; set; } public List AvailableAccounts { get; set; } = new(); } public class AccountSuggestion { public int AccountId { get; set; } public string AccountName { get; set; } = string.Empty; public double Confidence { get; set; } public string? Reasoning { get; set; } } public class AccountSuggestionResult { public bool Success { get; set; } public string? ErrorMessage { get; set; } public int? SuggestedAccountId { get; set; } public string? SuggestedAccountName { get; set; } public string? Reasoning { get; set; } public List Alternatives { get; set; } = new(); } /// Internal JSON schema that Claude returns for account suggestions. public class ClaudeAccountSuggestionResponse { public int? SuggestedAccountId { get; set; } public string? SuggestedAccountName { get; set; } public string? Reasoning { get; set; } public List Alternatives { get; set; } = new(); } public class ClaudeAccountAlternative { public int AccountId { get; set; } public string AccountName { get; set; } = string.Empty; public double Confidence { get; set; } public string? Reasoning { get; set; } } // ── Feature 4: Plain-English Financial Summary ──────────────────────────────── public class ExpenseByCategory { public string Category { get; set; } = string.Empty; public decimal Amount { get; set; } } public class FinancialSummaryRequest { public string CompanyName { get; set; } = string.Empty; public string Period { get; set; } = string.Empty; // e.g. "Last 6 months" public decimal TotalRevenue { get; set; } public decimal TotalExpenses { get; set; } public decimal NetIncome { get; set; } public decimal PriorMonthRevenue { get; set; } public decimal PriorMonthExpenses { get; set; } public decimal TotalArOutstanding { get; set; } public decimal ArOverdue30Days { get; set; } public int OverdueInvoiceCount { get; set; } public List ExpensesByCategory { get; set; } = new(); } public class FinancialSummaryResult { public bool Success { get; set; } public string? ErrorMessage { get; set; } /// Markdown bullet lines (plain English, no jargon). public List Bullets { get; set; } = new(); /// "positive", "neutral", or "concerning". public string Sentiment { get; set; } = "neutral"; } /// Internal JSON schema that Claude returns for financial summaries. public class ClaudeFinancialSummaryResponse { public List Bullets { get; set; } = new(); public string Sentiment { get; set; } = "neutral"; } // ── Feature 5: Cash Flow Forecast ───────────────────────────────────────────── public class CashFlowArItem { public string CustomerName { get; set; } = string.Empty; public string InvoiceNumber { get; set; } = string.Empty; public decimal BalanceDue { get; set; } public string? DueDateIso { get; set; } public int DaysOverdue { get; set; } public int AvgDaysToPay { get; set; } } public class CashFlowApItem { public string VendorName { get; set; } = string.Empty; public string BillNumber { get; set; } = string.Empty; public decimal BalanceDue { get; set; } public string? DueDateIso { get; set; } } public class CashFlowJobItem { public string JobNumber { get; set; } = string.Empty; public string CustomerName { get; set; } = string.Empty; public string Status { get; set; } = string.Empty; public decimal EstimatedValue { get; set; } } public class CashFlowForecastRequest { public string CompanyName { get; set; } = string.Empty; public string AsOfDate { get; set; } = string.Empty; public List OpenInvoices { get; set; } = new(); public List OpenBills { get; set; } = new(); public List ActiveJobs { get; set; } = new(); } public class CashFlowPeriod { public decimal ExpectedInflows { get; set; } public decimal ExpectedOutflows { get; set; } public decimal NetCashFlow { get; set; } public List KeyItems { get; set; } = new(); } public class CashFlowForecastResult { public bool Success { get; set; } public string? ErrorMessage { get; set; } public CashFlowPeriod Next30Days { get; set; } = new(); public CashFlowPeriod Next60Days { get; set; } = new(); public CashFlowPeriod Next90Days { get; set; } = new(); public List Insights { get; set; } = new(); /// "strong", "moderate", "tight", or "concerning" public string Outlook { get; set; } = "moderate"; } /// Internal JSON schema that Claude returns for cash flow forecasts. public class ClaudeCashFlowResponse { public ClaudeCashFlowPeriod Next30Days { get; set; } = new(); public ClaudeCashFlowPeriod Next60Days { get; set; } = new(); public ClaudeCashFlowPeriod Next90Days { get; set; } = new(); public List Insights { get; set; } = new(); public string Outlook { get; set; } = "moderate"; } public class ClaudeCashFlowPeriod { public decimal ExpectedInflows { get; set; } public decimal ExpectedOutflows { get; set; } public decimal NetCashFlow { get; set; } public List KeyItems { get; set; } = new(); } // ── Feature 6: Anomaly / Duplicate Detection ────────────────────────────────── public class AnomalyBillSummary { public int Id { get; set; } public string BillNumber { get; set; } = string.Empty; public string VendorName { get; set; } = string.Empty; public decimal Total { get; set; } public string BillDateIso { get; set; } = string.Empty; public string? VendorInvoiceNumber { get; set; } } public class AnomalyVendorHistory { public string VendorName { get; set; } = string.Empty; public decimal AverageInvoiceAmount { get; set; } public decimal AverageMonthlySpend { get; set; } public int InvoiceCount { get; set; } } public class AnomalyAccountTrend { public string AccountName { get; set; } = string.Empty; public decimal ThisMonthAmount { get; set; } public decimal LastMonthAmount { get; set; } public decimal AverageMonthlyAmount { get; set; } } public class AnomalyDetectionRequest { public string CompanyName { get; set; } = string.Empty; public List RecentBills { get; set; } = new(); public List VendorHistory { get; set; } = new(); public List AccountTrends { get; set; } = new(); } public class AnomalyFlag { /// "duplicate", "amount_spike", "unusual_vendor", "account_overrun" public string Type { get; set; } = string.Empty; /// "critical", "warning", "info" public string Severity { get; set; } = "warning"; public string Title { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string? RecommendedAction { get; set; } public string? BillNumber { get; set; } } public class AnomalyDetectionResult { public bool Success { get; set; } public string? ErrorMessage { get; set; } public List Flags { get; set; } = new(); public int CriticalCount { get; set; } public int WarningCount { get; set; } public int InfoCount { get; set; } } /// Internal JSON schema that Claude returns for anomaly detection. public class ClaudeAnomalyResponse { public List Flags { get; set; } = new(); } public class ClaudeAnomalyFlag { public string Type { get; set; } = string.Empty; public string Severity { get; set; } = "warning"; public string Title { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public string? RecommendedAction { get; set; } public string? BillNumber { get; set; } } // ── Feature 7: Bank Rec Auto-Match ─────────────────────────────────────────── public class BankRecMatchItem { public string EntityType { get; set; } = string.Empty; // "Payment", "BillPayment", "Expense" public int EntityId { get; set; } public string Date { get; set; } = string.Empty; // ISO 8601 public string Reference { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; public decimal Amount { get; set; } public string Direction { get; set; } = string.Empty; // "deposit" or "payment" } public class AutoMatchRequest { public List UnclearedItems { get; set; } = new(); public decimal BeginningBalance { get; set; } public decimal StatementEndingBalance { get; set; } } public class AutoMatchSuggestion { public string EntityType { get; set; } = string.Empty; public int EntityId { get; set; } public double Confidence { get; set; } // 0.0–1.0 public string Reason { get; set; } = string.Empty; } public class AutoMatchResult { public bool Success { get; set; } public string? ErrorMessage { get; set; } public List SuggestedCleared { get; set; } = new(); public List Insights { get; set; } = new(); } /// Internal JSON schema that Claude returns for bank rec auto-match. public class ClaudeAutoMatchResponse { public List SuggestedCleared { get; set; } = new(); public List Insights { get; set; } = new(); } public class ClaudeAutoMatchSuggestion { public string EntityType { get; set; } = string.Empty; public int EntityId { get; set; } public double Confidence { get; set; } public string Reason { get; set; } = string.Empty; } // ── Feature 8: Late Payment Prediction ─────────────────────────────────────── public class OpenInvoiceSummary { public string InvoiceNumber { get; set; } = string.Empty; public decimal BalanceDue { get; set; } public string? DueDateIso { get; set; } public int DaysOverdue { get; set; } } public class LatePaymentCustomerData { public string CustomerName { get; set; } = string.Empty; public decimal TotalOwed { get; set; } public double AvgDaysToPay { get; set; } // historical average public int TotalInvoicesAllTime { get; set; } public int LateInvoicesAllTime { get; set; } public List OpenInvoices { get; set; } = new(); } public class LatePaymentPredictionRequest { public string CompanyName { get; set; } = string.Empty; public List Customers { get; set; } = new(); } public class LatePaymentPrediction { public string CustomerName { get; set; } = string.Empty; /// "high", "medium", or "low" public string RiskLevel { get; set; } = "medium"; public int EstimatedDaysToPayment { get; set; } public string Reasoning { get; set; } = string.Empty; } public class LatePaymentPredictionResult { public bool Success { get; set; } public string? ErrorMessage { get; set; } public List Predictions { get; set; } = new(); public List Insights { get; set; } = new(); } /// Internal JSON schema that Claude returns for late payment predictions. public class ClaudeLatePaymentResponse { public List Predictions { get; set; } = new(); public List Insights { get; set; } = new(); } public class ClaudeLatePaymentPrediction { public string CustomerName { get; set; } = string.Empty; public string RiskLevel { get; set; } = "medium"; public int EstimatedDaysToPayment { get; set; } public string Reasoning { get; set; } = string.Empty; } // ── Feature 9: Natural Language Financial Queries ───────────────────────────── public class MonthlyFinancialSummary { public string Month { get; set; } = string.Empty; // "YYYY-MM" public decimal Revenue { get; set; } public decimal Expenses { get; set; } public decimal NetIncome { get; set; } } public class FinancialQueryContext { public string CompanyName { get; set; } = string.Empty; public string AsOfDate { get; set; } = string.Empty; public decimal TotalRevenueYtd { get; set; } public decimal TotalExpensesYtd { get; set; } public decimal NetIncomeYtd { get; set; } public decimal ArOutstanding { get; set; } public decimal ApOutstanding { get; set; } public List Last12Months { get; set; } = new(); public List ExpensesByCategory { get; set; } = new(); } public class FinancialQueryRequest { public string Question { get; set; } = string.Empty; public FinancialQueryContext Context { get; set; } = new(); } public class FinancialQueryResult { public bool Success { get; set; } public string? ErrorMessage { get; set; } public string Answer { get; set; } = string.Empty; public string? FollowUpSuggestion { get; set; } public List RelevantFacts { get; set; } = new(); } /// Internal JSON schema that Claude returns for financial queries. public class ClaudeFinancialQueryResponse { public string Answer { get; set; } = string.Empty; public string? FollowUpSuggestion { get; set; } public List RelevantFacts { get; set; } = new(); } // ── Feature 10: Recurring Bill Detection ───────────────────────────────────── public class RecurringBillHistoryItem { public string VendorName { get; set; } = string.Empty; public string BillNumber { get; set; } = string.Empty; public decimal Amount { get; set; } public string DateIso { get; set; } = string.Empty; public string? Memo { get; set; } } public class RecurringBillDetectionRequest { public string CompanyName { get; set; } = string.Empty; public List Bills { get; set; } = new(); } public class RecurringBillPattern { public string VendorName { get; set; } = string.Empty; /// "monthly", "quarterly", "biannual", "annual" public string Frequency { get; set; } = string.Empty; public decimal TypicalAmount { get; set; } public string? NextExpectedDateIso { get; set; } /// "high", "medium", or "low" public string Confidence { get; set; } = "medium"; public string Description { get; set; } = string.Empty; public string? SuggestedAction { get; set; } } public class RecurringBillDetectionResult { public bool Success { get; set; } public string? ErrorMessage { get; set; } public List Patterns { get; set; } = new(); public List Insights { get; set; } = new(); } /// Internal JSON schema that Claude returns for recurring bill detection. public class ClaudeRecurringBillResponse { public List Patterns { get; set; } = new(); public List Insights { get; set; } = new(); } public class ClaudeRecurringPattern { public string VendorName { get; set; } = string.Empty; public string Frequency { get; set; } = string.Empty; public decimal TypicalAmount { get; set; } public string? NextExpectedDateIso { get; set; } public string Confidence { get; set; } = "medium"; public string Description { get; set; } = string.Empty; public string? SuggestedAction { get; set; } }