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

namespace PlotLine.Controllers;

[AllowAnonymous]
[Route("word-companion")]
public sealed class WordCompanionHostController(ICurrentUserService currentUser) : Controller
{
    [HttpGet("")]
    public IActionResult Index()
    {
        return View(new WordCompanionHostViewModel
        {
            IsAuthenticated = currentUser.IsAuthenticated,
            DisplayName = currentUser.DisplayName,
            LoginUrl = Url.Action("Login", "Account", new { returnUrl = "/word-companion" }) ?? "/Account/Login?returnUrl=%2Fword-companion"
        });
    }
}

