namespace SIGCM2.Application.Audit;

public sealed record AuditEventQueryResult(
    IReadOnlyList<AuditEventDto> Items,
    string? NextCursor);

/// Persists and queries AuditEvent rows. Insert participates in any ambient
/// TransactionScope (single connection string enlistment — validated by B0 spike).
public interface IAuditEventRepository
{
    Task<long> InsertAsync(
        DateTime occurredAt,
        int? actorUserId,
        int? actorRoleId,
        string action,
        string targetType,
        string targetId,
        Guid? correlationId,
        string? ipAddress,
        string? userAgent,
        string? metadata,
        CancellationToken ct = default);

    Task<AuditEventQueryResult> QueryAsync(
        AuditEventFilter filter,
        CancellationToken ct = default);
}
