using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using NexusReader.Domain.Enums; using Pgvector; namespace NexusReader.Domain.Entities; public class KnowledgeUnit { [Key] [MaxLength(128)] public string Id { get; set; } = string.Empty; // Hash(Source + Content + Version) [Required] [MaxLength(128)] public string SourceId { get; set; } = string.Empty; [Required] [MaxLength(50)] public string Version { get; set; } = "1.0"; [Required] public KnowledgeUnitType Type { get; set; } [Required] public string Content { get; set; } = string.Empty; public string? MetadataJson { get; set; } // e.g. { "page": 1, "path": "Chapter 1 > Intro" } [Required] [MaxLength(128)] public string TenantId { get; set; } = string.Empty; public Vector? Vector { get; set; } public DateTime CreatedAt { get; set; } = DateTime.UtcNow; // Relationships public ICollection OutgoingLinks { get; set; } = new List(); public ICollection IncomingLinks { get; set; } = new List(); }