using MemberCenter.Application.Constants;
using MemberCenter.Web.Authorization;
using MemberCenter.Web.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace MemberCenter.Web.Areas.Admin.Controllers;

[Area("Admin")]
[Authorize(Policy = "Admin")]
[AdminPermission(AdminPermissions.Home)]
[Route("admin")]
public sealed class HomeController : Controller
{
    private readonly AdminDashboardFactory _adminDashboardFactory;

    public HomeController(AdminDashboardFactory adminDashboardFactory)
    {
        _adminDashboardFactory = adminDashboardFactory;
    }

    [HttpGet("")]
    [AdminPermission(AdminPermissions.Home)]
    public async Task<IActionResult> Index()
    {
        return View(await _adminDashboardFactory.BuildAsync());
    }
}
