namespace ViewEngine.Client.Models; /// /// Request to submit a web page retrieval job /// public class SubmitRetrievalRequest { /// /// The URL of the web page to retrieve (scheme optional, will default to https://) /// public string Url { get; set; } = string.Empty; /// /// Maximum time to wait in seconds (default: 60, max: 300) /// public int TimeoutSeconds { get; set; } = 60; /// /// Force fresh retrieval, bypassing cache (default: false) /// public bool ForceRefresh { get; set; } /// /// Number of feeders that must agree (Community mode only, 1-10) /// public int? RequiredQuorum { get; set; } /// /// Job priority (1=lowest, 10=highest, default: 5). Higher priority costs more. /// public int Priority { get; set; } = 5; /// /// Route job to specific client's feeder (requires Client Management setup) /// public Guid? ClientId { get; set; } /// /// Route job using your custom client identifier (alternative to clientId) /// public string? CustomUserId { get; set; } /// /// Restrict processing to a specific platform: "Android", "iOS", or "Windows" (Community mode only) /// public string? PreferredPlatform { get; set; } /// /// If true, generate an AI summary of the page content (default: false) /// public bool GenerateSummary { get; set; } = false; /// /// Target language code for translation (ISO 639-1, e.g., "en", "es", "de", "zh"). /// If specified and the page is in a different language, content will be translated. /// Null = no translation, return content as-is. /// public string? TargetLanguage { get; set; } } /// /// Response from submitting a retrieval request /// public class RetrievalResponse { /// /// Unique identifier for this retrieval request /// public Guid RequestId { get; set; } /// /// Current status of the request /// public string Status { get; set; } = string.Empty; /// /// User-friendly message describing the status /// public string Message { get; set; } = string.Empty; /// /// Estimated wait time in seconds /// public int? EstimatedWaitTimeSeconds { get; set; } } /// /// Status response for a retrieval request /// public class RetrievalStatusResponse { /// /// The request ID /// public Guid RequestId { get; set; } /// /// The URL being retrieved /// public string Url { get; set; } = string.Empty; /// /// Current status: queued, processing, validating, complete, failed, canceled /// public string Status { get; set; } = string.Empty; /// /// User-friendly status message /// public string Message { get; set; } = string.Empty; /// /// Content information (available when status is complete) /// public ContentInfo? Content { get; set; } /// /// Error message if status is failed /// public string? Error { get; set; } /// /// When the request was created /// public DateTime CreatedAt { get; set; } /// /// When the request was completed /// public DateTime? CompletedAt { get; set; } } /// /// Content information for a completed retrieval /// public class ContentInfo { /// /// URL to download the decrypted page content /// public string PageDataUrl { get; set; } = string.Empty; /// /// Hash of the retrieved content /// public string? ContentHash { get; set; } /// /// Artifacts such as screenshots and thumbnails /// public ArtifactsInfo? Artifacts { get; set; } /// /// Performance and quality metrics /// public Dictionary? Metrics { get; set; } } /// /// Artifacts from page retrieval /// public class ArtifactsInfo { /// /// URL to full page screenshot /// public string? Screenshot { get; set; } /// /// URL to page thumbnail /// public string? Thumbnail { get; set; } } /// /// Page content data returned from the API /// public class PageData { /// /// Page title /// public string Title { get; set; } = string.Empty; /// /// Full text content of the page /// public string Body { get; set; } = string.Empty; /// /// Meta description tag content /// public string? MetaDescription { get; set; } /// /// Final URL after any redirects /// public string Url { get; set; } = string.Empty; /// /// URL to the page's favicon /// public string? FaviconUrl { get; set; } /// /// Base64-encoded PNG screenshot of the page (typically 320x180) /// public string? Thumbnail { get; set; } /// /// Links found in navigation/header areas /// public List Routes { get; set; } = new(); /// /// Links found in page body content /// public List BodyRoutes { get; set; } = new(); /// /// Optional AI-generated summary of the page content /// public string? Summary { get; set; } /// /// HTTP status code from the page retrieval. /// Null if status code is not available. /// Common values: 200 (OK), 404 (Not Found), 500 (Server Error). /// public int? HttpStatusCode { get; set; } /// /// Returns true if the HTTP status code indicates success (2xx) or is not available. /// public bool IsSuccess => HttpStatusCode == null || (HttpStatusCode >= 200 && HttpStatusCode < 300); /// /// Returns true if the HTTP status code indicates a client error (4xx). /// public bool IsClientError => HttpStatusCode >= 400 && HttpStatusCode < 500; /// /// Returns true if the HTTP status code indicates a server error (5xx). /// public bool IsServerError => HttpStatusCode >= 500; /// /// Language of the page as declared in the HTML lang attribute (e.g., "en", "es", "zh-CN"). /// Null if not specified in the HTML. /// public string? HtmlLang { get; set; } /// /// Detected/confirmed language of the content (ISO 639-1 code, e.g., "en", "es", "zh"). /// May differ from HtmlLang if automatic language detection was performed. /// public string? DetectedLanguage { get; set; } /// /// If content was translated, this is the target language code. /// Null if no translation was performed. /// public string? TranslatedTo { get; set; } /// /// Original body text before translation. /// Only populated if translation occurred. /// public string? OriginalBody { get; set; } /// /// Original title before translation. /// Only populated if translation occurred. /// public string? OriginalTitle { get; set; } } /// /// Information about a link on the page /// public class LinkInfo { /// /// The link URL /// public string Url { get; set; } = string.Empty; /// /// The anchor text (what the link says) /// public string Text { get; set; } = string.Empty; /// /// Importance ranking (higher = more important, typically 1-10) /// public int Rank { get; set; } /// /// How many times this link appears on the page /// public int Occurrences { get; set; } /// /// Whether this link is likely an advertisement /// public bool IsPotentialAd { get; set; } /// /// Explanation of why the link was flagged as an ad (null if not an ad) /// public string? AdReason { get; set; } }