using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;

namespace Knot.Modules.Stories.Application.Abstractions;

internal sealed class StoryNotificationService : IStoryNotificationService
{
    private readonly ILogger<StoryNotificationService> _logger;

    public StoryNotificationService(ILogger<StoryNotificationService> logger)
    {
        _logger = logger;
    }

    public Task NotifyStoryViewedAsync(
        Guid storyId,
        Guid userId,
        string? username,
        string? displayName,
        string? avatar,
        int newViewsCount,
        Guid storyOwnerId,
        CancellationToken ct = default)
    {
        // TODO: Реализовать отправку через SignalR
        // Пока заглушка - в будущем использовать IHubContext
        _logger.LogInformation(
            "Story {StoryId} viewed by user {UserId}. New views count: {ViewsCount}",
            storyId, userId, newViewsCount);

        return Task.CompletedTask;
    }
}
