using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using PSTW_CentralSystem.DBContext;

namespace PSTW_CentralSystem.Controllers.API
{
    [ApiController]
    [Route("[controller]")]
    public class RoleAPI : Controller
    {

        private readonly ILogger<HomeController> _logger;
        private readonly IdentityDBContext _authDbContext;

        public RoleAPI(ILogger<HomeController> logger, IdentityDBContext authDbContext)
        {
            _logger = logger; 
            _authDbContext = authDbContext;
        }

        [HttpPost("GetRoleList")]
        public async Task<IActionResult> GetRoleList()
        {
            var roleList = await _authDbContext.Roles.Where(r => r.Id != 1 && r.Id != 2).ToListAsync();
            return Json(roleList);
        }
    }
}
