using Newtonsoft.Json; using System.Collections.Generic; namespace Knoks.Api.Entities { public enum ApiErrorType : int { Undefined = -1, InvalidApiIdentifier = 1, ApiConsumerIsDisabled = 2, InvalidUsernameOrPassword = 3, InvalidPinCode = 4, Validation = 5, Authorization = 6, PasswordIsNotStrong = 7, UserNameAlreadyExists = 8, UserEmailAlreadyExists = 9, UserEmailDoesNotExist = 10 } public class ApiError { public ApiErrorType Id { get; } public string Msg { get; } [JsonIgnore] public IDictionary Errors { get; } [JsonProperty("errors", NullValueHandling = NullValueHandling.Ignore)] internal PropertyDictionary _Errors { get { return Errors == null ? null : new PropertyDictionary(Errors); } } public ApiError(ApiErrorType id, string msg, IDictionary errors = null) { Id = id; Msg = msg; Errors = errors; } } }