using XF.Domain.Entities;
using XF.Domain.Repository;

namespace Hotline.Repository.SqlSugar.Ts;

public interface IRepositoryTextSearch<TEntity>
    where TEntity : class, ITextSearch, new()
{
    /// <summary>
    /// 全都采用默认权重
    /// </summary>
    /// <param name="id">原始数据Id</param>
    /// <param name="creationTime">原始数据CreationTime</param>
    /// <param name="texts"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task AddVectorAsync(string id, DateTime creationTime, ICollection<string> texts, CancellationToken cancellationToken);

    /// <summary>
    /// 全都采用默认权重
    /// </summary>
    Task UpdateVectorAsync(string id, ICollection<string> texts, CancellationToken cancellationToken);

    /// <summary>
    /// 返回值默认按权重排序（返回值继承：RankedResult可获得匹配度：score）
    /// </summary>
    /// <param name="texts"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task<List<TEntity>> SearchAsync(IReadOnlyList<string> texts, CancellationToken cancellationToken);

    /// <summary>
    /// 根据id获取
    /// </summary>
    /// <param name="id"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task<List<TEntity>> SearchAsync(string id, CancellationToken cancellationToken);
}