using LiteDB; namespace AuthorBuddy.Web.Data; public enum UserRole { Author, Administrator, Blogger, Chat } public class UserEntity { public int Id { get; set; } public string Name { get; set; } = string.Empty; public string Email { get; set; } = string.Empty; public string PasswordHash { get; set; } = string.Empty; public string TwoFactorSecret { get; set; } = string.Empty; public bool TwoFactorEnabled { get; set; } public List Roles { get; set; } = new() { UserRole.Author }; public bool IsActive { get; set; } = true; [BsonIgnore] public bool IsAdministrator => Roles.Contains(UserRole.Administrator); public bool HasRole(UserRole role) => Roles.Contains(role); public bool HasAnyRole(params UserRole[] roles) => roles.Any(HasRole); }