| | | 1 | | using ArturRios.Util.Http; |
| | | 2 | | |
| | | 3 | | namespace ArturRios.Heimdall.Shared.Messages; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Maps each <see cref="GoogleUserMessages" /> value to its HTTP status code, following the UC-27 |
| | | 7 | | /// – UC-29 flows. Passed to the response resolver. |
| | | 8 | | /// </summary> |
| | | 9 | | public static class GoogleUserMessageMap |
| | | 10 | | { |
| | 4 | 11 | | public static readonly IReadOnlyDictionary<string, int> StatusCodes = |
| | 4 | 12 | | DataAccessMessageMap.CombinedWith(new Dictionary<string, int> |
| | 4 | 13 | | { |
| | 4 | 14 | | // UC-27 main flow — Google User(s) retrieved. |
| | 4 | 15 | | [GoogleUserMessages.GoogleUserRetrievedSuccessfully] = HttpStatusCodes.Ok, |
| | 4 | 16 | | [GoogleUserMessages.GoogleUsersRetrievedSuccessfully] = HttpStatusCodes.Ok, |
| | 4 | 17 | | // AF-27a — no such Google User in the addressed scope, or it is logically deleted and was |
| | 4 | 18 | | // not explicitly requested (FR-GO-17). |
| | 4 | 19 | | [GoogleUserMessages.GoogleUserNotFound] = HttpStatusCodes.NotFound, |
| | 4 | 20 | | // AF-27a on the listing — the scope itself is missing or logically deleted. |
| | 4 | 21 | | [GoogleUserMessages.ScopeNotFound] = HttpStatusCodes.NotFound, |
| | 4 | 22 | | // AF-27b — the caller may not view this Google User. |
| | 4 | 23 | | [GoogleUserMessages.NotAuthorizedToViewGoogleUser] = HttpStatusCodes.Forbidden, |
| | 4 | 24 | | // AF-27b on the listing — the acting Scope Admin does not own the addressed scope. |
| | 4 | 25 | | [GoogleUserMessages.NotScopeOwner] = HttpStatusCodes.Forbidden, |
| | 4 | 26 | | // UC-28 main flow — Google User logically deleted. AF-28b answers with the same 200, so the |
| | 4 | 27 | | // response's AlreadyDeleted flag is what tells the two paths apart. AF-28a reuses |
| | 4 | 28 | | // GoogleUserNotFound above. |
| | 4 | 29 | | [GoogleUserMessages.GoogleUserDeletedSuccessfully] = HttpStatusCodes.Ok, |
| | 4 | 30 | | // AF-28c — the caller may not delete this Google User. |
| | 4 | 31 | | [GoogleUserMessages.NotAuthorizedToDeleteGoogleUser] = HttpStatusCodes.Forbidden, |
| | 4 | 32 | | // UC-29 main flow — Google User hard deleted. AF-29a reuses GoogleUserNotFound above, and |
| | 4 | 33 | | // UC-29's only other refusals are the framework's: 403 from [RoleRequirement], 401 |
| | 4 | 34 | | // unauthenticated. |
| | 4 | 35 | | [GoogleUserMessages.GoogleUserHardDeletedSuccessfully] = HttpStatusCodes.Ok, |
| | 4 | 36 | | // UC-27 listing (NFR-10) — invalid pagination or an over-length name/email filter. |
| | 4 | 37 | | [PaginationMessages.InvalidPageNumber] = HttpStatusCodes.BadRequest, |
| | 4 | 38 | | [PaginationMessages.InvalidPageSize] = HttpStatusCodes.BadRequest, |
| | 4 | 39 | | [PaginationMessages.FilterTooLong] = HttpStatusCodes.BadRequest |
| | 4 | 40 | | }); |
| | | 41 | | } |