using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using PlotLine.Services;

namespace PlotLine.Controllers;

[Authorize]
public sealed class AnalyticsController(IAnalyticsService analytics) : Controller
{
    public async Task<IActionResult> Index(
        int projectId,
        int? bookId,
        decimal? startChapterNumber,
        decimal? endChapterNumber,
        decimal? startSceneNumber,
        decimal? endSceneNumber)
    {
        var model = await analytics.GetStoryHealthAsync(projectId, bookId, startChapterNumber, endChapterNumber, startSceneNumber, endSceneNumber);
        return model is null ? NotFound() : View(model);
    }
}
