namespace OmsorgCore.Application.Services;

public class AuthResult
{
    public bool Success { get; init; }
    public Guid? UserId { get; init; }
    public string? Username { get; init; }
    public string? Token { get; init; }
    public string? RefreshToken { get; init; }
    public DateTime? ExpiresAt { get; init; }
    public bool MustChangePassword { get; init; }
    public bool IsLockedOut { get; init; }

    public static AuthResult Fail() => new() { Success = false };

    public static AuthResult LockedOut() => new() { Success = false, IsLockedOut = true };

    public static AuthResult Ok(Guid userId, string username, string token, string refreshToken, DateTime expiresAt, bool mustChangePassword) => new()
    {
        Success = true,
        UserId = userId,
        Username = username,
        Token = token,
        RefreshToken = refreshToken,
        ExpiresAt = expiresAt,
        MustChangePassword = mustChangePassword
    };
}
