namespace PlotLine.Models; public class AuthenticationResult { public bool Success { get; init; } public string? ErrorMessage { get; init; } public bool RequiresTwoFactor { get; init; } public static AuthenticationResult Succeeded() => new() { Success = true }; public static AuthenticationResult Failed(string errorMessage) => new() { ErrorMessage = errorMessage }; public static AuthenticationResult TwoFactorRequired() => new() { RequiresTwoFactor = true }; } public sealed class RegistrationResult : AuthenticationResult { public int? UserID { get; init; } public static RegistrationResult Succeeded(int userId) => new() { Success = true, UserID = userId }; public new static RegistrationResult Failed(string errorMessage) => new() { ErrorMessage = errorMessage }; } public sealed class TwoFactorSetupResult : AuthenticationResult { public IReadOnlyList RecoveryCodes { get; init; } = Array.Empty(); public static TwoFactorSetupResult Succeeded(IReadOnlyList recoveryCodes) => new() { Success = true, RecoveryCodes = recoveryCodes }; public new static TwoFactorSetupResult Failed(string errorMessage) => new() { ErrorMessage = errorMessage }; }