using Shared.Data.Entities;
namespace PageFetcher.Data.Entities;
///
/// Audit record of a single page-fetch operation performed by the page-fetcher-api.
/// Stores the full rendered HTML and extracted plain text for every URL fetched.
///
public sealed class PageFetchEntity : BaseEntity
{
/// The URL that was requested.
public string Url { get; set; } = string.Empty;
/// Name of the service that requested the fetch (e.g. cv-matcher-api, cv-search-job).
public string CallerService { get; set; } = string.Empty;
/// HTTP status code returned by the remote server. null on network failure.
public int? HttpStatusCode { get; set; }
/// Full rendered HTML as returned by Playwright.
public string Html { get; set; } = string.Empty;
/// Plain text extracted from the HTML (script/style stripped, whitespace normalised).
public string Text { get; set; } = string.Empty;
/// Playwright round-trip time in milliseconds.
public long DurationMs { get; set; }
/// true when the page was fetched successfully; false on timeout or network error.
public bool Success { get; set; }
/// Exception message when is false.
public string? ErrorMessage { get; set; }
}