using System.Text.Json;
using Tiku.Domain.Common;

namespace Tiku.Domain.Catalog;

public sealed class TaxonomyNode : AuditableTenantEntity
{
    public Guid? ParentOwnerTenantId { get; set; }
    public Guid? ParentId { get; set; }
    public TaxonomyNodeType NodeType { get; set; } = TaxonomyNodeType.KnowledgePoint;
    public string Code { get; set; } = string.Empty;
    public string Name { get; set; } = string.Empty;
    public string? Path { get; set; }
    public int Depth { get; set; }
    public int SortOrder { get; set; }
    public bool IsActive { get; set; } = true;
    public JsonElement Metadata { get; set; } = JsonDefaults.Object();
}

public sealed class QuestionTaxonomyAssignment : Entity, ITenantOwned
{
    public Guid QuestionId { get; set; }
    public Guid TaxonomyOwnerTenantId { get; set; }
    public Guid TaxonomyNodeId { get; set; }
    public bool IsPrimary { get; set; }
    public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
    public Guid TenantId { get; set; }
}

public enum TaxonomyNodeType
{
    Subject,
    Chapter,
    KnowledgePoint,
    Paper,
    Custom
}