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

namespace MemberCenter.Web.Areas.Admin.Controllers;

[Area("Admin")]
[Authorize(Policy = "Admin")]
[AdminPermission(AdminPermissions.AuditLogs)]
[Route("admin/audit-logs")]
public class AuditLogsController : Controller
{
    private readonly IAuditLogService _auditLogService;

    public AuditLogsController(IAuditLogService auditLogService)
    {
        _auditLogService = auditLogService;
    }

    [HttpGet("")]
    [AdminPermission(AdminPermissions.AuditLogsIndex)]
    public async Task<IActionResult> Index()
    {
        var logs = await _auditLogService.ListAsync();
        return View(logs);
    }
}
