using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NetworkResurrector.Api.Application.Queries;
using System.Threading.Tasks;

namespace NetworkResurrector.Api.Controllers
{
    [Authorize]
    [ApiController]
    [Route("security")]
    public class SecurityController : ControllerBase
    {
        private readonly IMediator _mediator;

        public SecurityController(IMediator mediator)
        {
            _mediator = mediator;
        }

        [HttpGet("permissions")]
        public async Task<IActionResult> GetUserPermissions([FromRoute] GetUserPermissions.Query query)
        {
            var result = await _mediator.Send(query);
            return Ok(result);
        }
    }
}
