using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; /// /// User directory for batch assignment and operational lookups. /// [ApiController] [Route("api/v1/users")] [Produces("application/json")] [Authorize] public class UsersController : ControllerBase { private readonly IUserDirectoryService _users; public UsersController(IUserDirectoryService users) => _users = users; /// /// Lists active users, optionally filtered by role. /// [HttpGet] [Authorize(Roles = "INTAKE_CLERK,ADMINISTRATOR")] [ProducesResponseType(typeof(ApiResponse>), StatusCodes.Status200OK)] public async Task List([FromQuery] string? role) { UserRole? parsedRole = null; if (!string.IsNullOrWhiteSpace(role)) parsedRole = UserRoleExtensions.FromDbString(role); var results = await _users.ListByRoleAsync(parsedRole); return Ok(ApiResponse>.Ok(results)); } }