using System; using Microsoft.Extensions.Logging; using AyaNova.Models; using System.Linq; using System.Collections.Generic; namespace AyaNova.Api.ControllerHelpers { internal static class ApiErrorCodeStockMessage { internal static string GetMessage(ApiErrorCode code) { switch (code) { case ApiErrorCode.API_CLOSED: return "API Closed"; case ApiErrorCode.API_OPS_ONLY: return "API Closed to non operations routes"; case ApiErrorCode.CONCURRENCY_CONFLICT: return "Object was changed by another user since retrieval (concurrency token mismatch)"; case ApiErrorCode.NOT_FOUND: return "Object not found"; case ApiErrorCode.VALIDATION_FAILED: return "Object did not pass validation"; case ApiErrorCode.VALIDATION_REQUIRED: return "Required field empty"; case ApiErrorCode.VALIDATION_LENGTH_EXCEEDED: return "Field too long"; case ApiErrorCode.VALIDATION_INVALID_VALUE: return "Field is set to a non allowed value"; case ApiErrorCode.AUTHENTICATION_FAILED: return "Authentication failed"; case ApiErrorCode.PUT_ID_MISMATCH: return "Update failed: ID mismatch - route ID doesn't match object id"; case ApiErrorCode.INVALID_OPERATION: return "An attempt was made to perform an invalid operation"; case ApiErrorCode.NOT_AUTHORIZED: return "User not authorized for this resource operation (insufficient rights)"; default: return null; } } /* VALIDATION_FAILED = 2200, VALIDATION_REQUIRED = 2201, VALIDATION_LENGTH_EXCEEDED = 2202, VALIDATION_INVALID_VALUE = 2203 */ } }//eons