using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using SkillManagementBLL.EmployeeSkillProfile; using static GB5Shared.GB5Constant.Constant; namespace SkillManagementSL.EndPoints.SkillMatrix { // Returns all saved skill-level rows for one employee × one skill. // Used by the Skill Matrix cell-click lightbox to show full level history // (Level 1 → Level N) in readonly view, ordered by level number ascending. public class GetEmployeeSkillCellDetail : BaseEndpoint> { private readonly IEmployeeSkillProfileBLL _bll; public GetEmployeeSkillCellDetail(IEmployeeSkillProfileBLL bll) { _bll = bll; } public override void Configure() { Get("/SkillMatrix/GetEmployeeSkillCellDetail"); AllowAnonymous(); } public record GetEmployeeSkillCellDetailParameters( [property: FromHeader] string Login, [property: QueryParam] int EmployeeId, [property: QueryParam] int SkillId ); protected override string? GetCacheKey(GetEmployeeSkillCellDetailParameters req, LoginDTO login) => $"Skill:CellDetail:{login.ClientId}:{req.EmployeeId}:{req.SkillId}"; protected override async Task> ExecuteAsync( GetEmployeeSkillCellDetailParameters req, LoginDTO login, CancellationToken ct) { try { var result = await _bll.GetCellDetail(req.EmployeeId, req.SkillId, login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.CLIENT_LEVEL, login, ex.Message, 500); } } } }