959e323f3a
Feature 7: Bank Rec Auto-Match — AiSuggestMatches endpoint scores uncleared transactions vs statement ending balance; AI Auto-Match panel in Reconcile.cshtml with confidence highlights and Apply All button. Feature 8: Late Payment Prediction — PredictLatePayments endpoint scores open AR customers by risk (high/medium/low) using historical avg-days-to-pay + late rate; rendered as badge table in AR Aging view via ar-aging-ai.js. Feature 9: Natural Language Financial Queries — FinancialQuery GET page + RunFinancialQuery POST; 12-month context snapshot pre-loaded; answers grounded in real data with supporting facts, follow-up suggestions, session history, and example chips. Feature 10: Recurring Bill Detection — RunRecurringDetection scans 12 months of bills for vendor payment patterns (monthly/quarterly/annual); card grid view in Bills/RecurringDetection.cshtml with confidence badges, next-expected-date, and suggested actions. Supporting: 4 new DTO groups in AccountingAiDtos.cs, 4 method signatures in IAccountingAiService.cs, 4 implementations in AccountingAiService.cs, 4 new AiFeatures constants, 2 new Landing page AI report cards. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
76 lines
3.5 KiB
C#
76 lines
3.5 KiB
C#
using PowderCoating.Application.DTOs.AI;
|
||
|
||
namespace PowderCoating.Application.Interfaces;
|
||
|
||
public interface IAccountingAiService
|
||
{
|
||
/// <summary>
|
||
/// Scans a receipt/invoice image and extracts vendor, date, total, invoice number, and line items.
|
||
/// Attempts to match each line item to one of the provided expense accounts.
|
||
/// </summary>
|
||
Task<ReceiptScanResult> ScanReceiptAsync(
|
||
byte[] imageData,
|
||
string mimeType,
|
||
List<AccountSummary> availableAccounts);
|
||
|
||
/// <summary>
|
||
/// Drafts a follow-up email for an overdue AR customer.
|
||
/// Tone scales with days overdue: gentle (≤30), firm (31-60), serious (61+).
|
||
/// </summary>
|
||
Task<ArFollowUpResult> DraftFollowUpEmailAsync(ArFollowUpRequest request);
|
||
|
||
/// <summary>
|
||
/// Suggests the best-matching expense account for a bill line item or expense.
|
||
/// Returns a primary suggestion plus up to 3 ranked alternatives.
|
||
/// </summary>
|
||
Task<AccountSuggestionResult> SuggestAccountAsync(AccountSuggestionRequest request);
|
||
|
||
/// <summary>
|
||
/// Generates a plain-English financial health summary with 4-6 bullet points
|
||
/// and a sentiment classification (positive / neutral / concerning).
|
||
/// </summary>
|
||
Task<FinancialSummaryResult> GenerateFinancialSummaryAsync(FinancialSummaryRequest request);
|
||
|
||
/// <summary>
|
||
/// Projects 30/60/90-day cash position based on open AR, open AP, and active job pipeline.
|
||
/// Returns period-by-period inflow/outflow estimates and plain-English insights.
|
||
/// </summary>
|
||
Task<CashFlowForecastResult> GenerateCashFlowForecastAsync(CashFlowForecastRequest request);
|
||
|
||
/// <summary>
|
||
/// Scans recent bills and expense account trends for duplicates, unusual amounts,
|
||
/// and accounts running significantly above historical averages.
|
||
/// Returns a ranked list of flagged items with recommended actions.
|
||
/// </summary>
|
||
Task<AnomalyDetectionResult> DetectAnomaliesAsync(AnomalyDetectionRequest request);
|
||
|
||
/// <summary>
|
||
/// Suggests which uncleared bank rec items should be marked as cleared to reconcile
|
||
/// a statement. Returns a ranked list of suggestions with confidence scores based on
|
||
/// amount/date patterns and the gap between the current cleared balance and the
|
||
/// statement ending balance.
|
||
/// </summary>
|
||
Task<AutoMatchResult> AutoMatchReconciliationAsync(AutoMatchRequest request);
|
||
|
||
/// <summary>
|
||
/// Predicts likelihood of late payment for each open AR customer using their historical
|
||
/// payment behavior (avg days to pay, late rate) combined with current overdue status.
|
||
/// Returns risk levels (high/medium/low) and estimated days to collection.
|
||
/// </summary>
|
||
Task<LatePaymentPredictionResult> PredictLatePaymentsAsync(LatePaymentPredictionRequest request);
|
||
|
||
/// <summary>
|
||
/// Answers a plain-English financial question (e.g. "What did we spend on powder last quarter?")
|
||
/// using pre-loaded company financial context. Returns a direct answer, supporting facts,
|
||
/// and an optional follow-up question suggestion.
|
||
/// </summary>
|
||
Task<FinancialQueryResult> AnswerFinancialQueryAsync(FinancialQueryRequest request);
|
||
|
||
/// <summary>
|
||
/// Analyzes 6–12 months of bill history to detect recurring payment patterns per vendor.
|
||
/// Returns detected patterns with frequency, typical amount, next expected date, and
|
||
/// suggested actions (e.g. set a reminder, create a template).
|
||
/// </summary>
|
||
Task<RecurringBillDetectionResult> DetectRecurringBillsAsync(RecurringBillDetectionRequest request);
|
||
}
|