using BCards.Web.Areas.Support.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Security.Claims; namespace BCards.Web.Areas.Support.Controllers; [Area("Support")] [Authorize] public class SupportController : Controller { private readonly ISupportService _supportService; private readonly ILogger _logger; public SupportController(ISupportService supportService, ILogger logger) { _supportService = supportService; _logger = logger; } [HttpGet] public async Task ContactForm() { var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; var options = await _supportService.GetAvailableOptionsAsync(userId); if (!options.CanUseContactForm) { _logger.LogWarning("Usuário {UserId} tentou acessar formulário sem permissão", userId); TempData["Error"] = "Seu plano atual não tem acesso ao formulário de contato. Faça upgrade para o plano Básico ou superior."; return RedirectToAction("Index", "Home", new { area = "" }); } return View(options); } [HttpGet] [Route("Support/Index")] public async Task Index() { var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; var options = await _supportService.GetAvailableOptionsAsync(userId); return View(options); } }