namespace Scry.Core.Models;

public record ScanResult
{
    public bool Success { get; init; }
    public Card? Card { get; init; }
    public float Confidence { get; init; }
    public string? ErrorMessage { get; init; }
    public int HammingDistance { get; init; }
    public TimeSpan ProcessingTime { get; init; }
    
    public static ScanResult Failed(string message) => new()
    {
        Success = false,
        ErrorMessage = message,
        Confidence = 0
    };
    
    public static ScanResult Matched(Card card, float confidence, int hammingDistance, TimeSpan processingTime) => new()
    {
        Success = true,
        Card = card,
        Confidence = confidence,
        HammingDistance = hammingDistance,
        ProcessingTime = processingTime
    };
}
