PlotDirector/PlotLine/Models/AuthResultModels.cs
2026-06-06 19:01:13 +01:00

22 lines
715 B
C#

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 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 };
}