using System.Text.Json;
using Tiku.Domain.Catalog;
using Tiku.Domain.Content;

namespace Tiku.Application.Catalog;

public sealed record TaxonomyNodeItem(
    Guid Id,
    QuestionSource Source,
    Guid? ParentId,
    QuestionSource? ParentSource,
    TaxonomyNodeType NodeType,
    string Code,
    string Name,
    string? Path,
    int Depth,
    int SortOrder,
    JsonElement Metadata);

public sealed record CreateTaxonomyNodeCommand(
    Guid? ParentId,
    QuestionSource? ParentSource,
    TaxonomyNodeType NodeType,
    string Code,
    string Name,
    int SortOrder,
    JsonElement Metadata);

public interface ITaxonomyService
{
    Task<IReadOnlyCollection<TaxonomyNodeItem>> ListAsync(Guid tenantId, CancellationToken cancellationToken = default);
    Task<TaxonomyNodeItem> CreateAsync(
        Guid tenantId,
        CreateTaxonomyNodeCommand command,
        CancellationToken cancellationToken = default);
}
