namespace PageFetcher.Models;

/// <summary>
/// Result of a page fetch operation.
/// </summary>
public sealed class FetchPageResponse
{
    /// <summary>Final URL after any redirects.</summary>
    public string Url { get; set; } = string.Empty;

    /// <summary>HTTP status code returned by the page. <c>0</c> on network failure.</summary>
    public int StatusCode { get; set; }

    /// <summary>Full rendered HTML as returned by Playwright.</summary>
    public string Html { get; set; } = string.Empty;

    /// <summary>Plain text extracted from the HTML (script/style stripped, whitespace normalised).</summary>
    public string Text { get; set; } = string.Empty;

    /// <summary>Whether the fetch succeeded. <c>false</c> on timeout or network error.</summary>
    public bool Success { get; set; }

    /// <summary>Exception message when <see cref="Success"/> is <c>false</c>.</summary>
    public string? Error { get; set; }
}
