using Baya.Application.Models.Common;
using Baya.Application.Models.Notifications;

namespace Baya.Application.Contracts.Notifications;

/// <summary>
/// Reads and per-user commands over the in-app notification store. Every operation is tenant-scoped to
/// the passed <c>userId</c> (always the authenticated caller — never a body-supplied id). Minting a new
/// notification is done through <see cref="Common.INotificationDispatcher"/>, not here.
/// </summary>
public interface INotificationService
{
    /// <summary>The caller's notifications, unread-first then newest-first.</summary>
    ValueTask<PagedResult<NotificationDto>> ListMineAsync(int userId, int page, int pageSize, CancellationToken cancellationToken = default);

    ValueTask<int> GetUnreadCountAsync(int userId, CancellationToken cancellationToken = default);

    /// <summary>Marks one of the caller's notifications read; returns <c>false</c> if it isn't theirs or doesn't exist.</summary>
    ValueTask<bool> MarkReadAsync(int userId, long notificationId, CancellationToken cancellationToken = default);

    /// <summary>Marks all of the caller's unread notifications read; returns the number flipped.</summary>
    ValueTask<int> MarkAllReadAsync(int userId, CancellationToken cancellationToken = default);

    /// <summary>Hard-deletes read notifications older than <paramref name="retentionDays"/>; never touches unread. Returns the count removed.</summary>
    ValueTask<int> PurgeOldReadAsync(int retentionDays, CancellationToken cancellationToken = default);
}
