using Intentor.Models;

namespace Intentor.Data;

public interface IIntentActivationRepository
{
    Task<IntentActivation> ActivateAsync(
        int spaceId,
        int intentId,
        DateTimeOffset? until = null,
        string? source = null,
        CancellationToken ct = default);

    Task DeactivateAsync(long activationId, CancellationToken ct = default);

    Task<int> DeactivateBySourceAsync(int spaceId, string source, CancellationToken ct = default);

    Task<int> CleanupExpiredAsync(DateTimeOffset now, CancellationToken ct = default);

    /// <summary>
    /// Returns the currently "effective" intent for a space (highest priority among active activations),
    /// including its Action.
    /// </summary>
    Task<Intent?> GetEffectiveIntentAsync(int spaceId, DateTimeOffset now, CancellationToken ct = default);
}
