Files
Finlytic/FinlyticNews/Entities/NewsArticleEntity.cs
T

81 lines
2.4 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace FinlyticNews.Entities;
/// <summary>
/// Represents a news article record stored in the database, tracking its lifecycle status and classification details.
/// </summary>
public class NewsArticleEntity
{
/// <summary>
/// Gets or sets the unique primary key identifier.
/// </summary>
[Key]
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the title of the article.
/// </summary>
[Required]
public string Title { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the author of the article.
/// </summary>
public string? Author { get; set; }
/// <summary>
/// Gets or sets a brief summary of the article content.
/// </summary>
public string? Summary { get; set; }
/// <summary>
/// Gets or sets the raw extracted text content.
/// </summary>
[Required]
public string ContentRaw { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the language of the article.
/// </summary>
public string? Language { get; set; }
/// <summary>
/// Gets or sets the unique source URL of the article. Used for duplicate checking (idempotency).
/// </summary>
[Required]
public string SourceUrl { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the local timestamp when the scraper processed this article.
/// </summary>
public DateTime ScrapedAt { get; set; }
/// <summary>
/// Gets or sets the original publication date of the article.
/// </summary>
public DateTime PublishedAt { get; set; }
/// <summary>
/// Gets or sets the processing lifecycle state (e.g., "Pending", "Processing", "Completed", "Analyzed", "Failed", "Duplicate").
/// </summary>
[Required]
public string Status { get; set; } = "Pending";
/// <summary>
/// Gets or sets the normalized SHA-256 hash of the cleaned title for duplicate detection.
/// </summary>
[MaxLength(64)]
public string? TitleHash { get; set; }
/// <summary>
/// Gets or sets the 64-bit SimHash content fingerprint for fuzzy duplicate text detection.
/// </summary>
public long? SimHash { get; set; }
/// <summary>
/// Gets or sets the list of financial assets matched and associated with this news article.
/// </summary>
public List<MatchedAssetEntity> MatchedAssets { get; set; } = [];
}