books/backend/Books.Api/AiBookkeeper/IAccountMappingService.cs
Nicolaj Hartmann 1f75c5d791 Add all backend domain, commands, repositories, and tests
This commit includes all previously untracked backend files:

Domain:
- Accounts, Attachments, BankConnections, Customers
- FiscalYears, Invoices, JournalEntryDrafts
- Orders, Products, UserAccess

Commands & Handlers:
- Full CQRS command structure for all domains

Repositories:
- PostgreSQL repositories for all read models
- Bank transaction and ledger repositories

GraphQL:
- Input types, scalars, and types for all entities
- Mutations and queries

Infrastructure:
- Banking integration (Enable Banking client)
- File storage, Invoicing, Reporting, SAF-T export
- Database migrations (003-029)

Tests:
- Integration tests for GraphQL endpoints
- Domain tests
- Invoicing and reporting tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 22:19:42 +01:00

54 lines
1.9 KiB
C#

using Books.Api.EventFlow.ReadModels;
namespace Books.Api.AiBookkeeper;
/// <summary>
/// Maps standard account numbers (from Erhvervsstyrelsen) to company-specific accounts.
/// </summary>
public interface IAccountMappingService
{
/// <summary>
/// Find the company's account that matches a standard account number.
/// </summary>
/// <param name="companyId">Company ID</param>
/// <param name="standardAccountNumber">Standard account number from Erhvervsstyrelsen</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>The matching account, or null if not found</returns>
Task<AccountReadModelDto?> FindByStandardAccountNumberAsync(
string companyId,
string standardAccountNumber,
CancellationToken cancellationToken = default);
/// <summary>
/// Map AI-suggested lines to company accounts.
/// </summary>
/// <param name="companyId">Company ID</param>
/// <param name="suggestedLines">Lines from AI suggestion</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>Mapped lines with company account IDs</returns>
Task<List<MappedSuggestedLine>> MapSuggestedLinesAsync(
string companyId,
List<SuggestedLine> suggestedLines,
CancellationToken cancellationToken = default);
}
/// <summary>
/// A suggested line with the mapped company account.
/// </summary>
public class MappedSuggestedLine
{
/// <summary>
/// Original suggested line from AI.
/// </summary>
public required SuggestedLine Original { get; init; }
/// <summary>
/// Mapped company account (if found).
/// </summary>
public AccountReadModelDto? MappedAccount { get; init; }
/// <summary>
/// Whether the line was successfully mapped to a company account.
/// </summary>
public bool IsMapped => MappedAccount != null;
}