using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace NexusReader.Domain.Entities;

public class KnowledgeUnitLink
{
    [Key]
    public int Id { get; set; }

    [Required]
    [MaxLength(128)]
    public string SourceUnitId { get; set; } = string.Empty;

    [Required]
    [MaxLength(128)]
    public string TargetUnitId { get; set; } = string.Empty;

    [Required]
    [MaxLength(50)]
    public string RelationType { get; set; } = "References"; // e.g., "Next", "Defines", "Contains"

    [ForeignKey(nameof(SourceUnitId))]
    public KnowledgeUnit SourceUnit { get; set; } = null!;

    [ForeignKey(nameof(TargetUnitId))]
    public KnowledgeUnit TargetUnit { get; set; } = null!;
}
