using Hotline.KnowledgeBase;
using Hotline.Share.Dtos;
using Hotline.Share.Dtos.Knowledge;
using Hotline.Share.Requests;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;

namespace Hotline.Application.Knowledge
{
    public interface IKnowApplication
    {
        /// <summary>
        /// 知识库查询
        /// </summary>
        /// <param name="pagedDto"></param>
        /// <returns></returns>
        Task<(int, IList<KnowledgeDataDto>)> GetKnowList(KnowPagedListDto pagedDto, CancellationToken cancellationToken);

        /// <summary>
        /// 知识申请查询
        /// </summary>
        /// <param name="pagedDto"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<PagedDto<KnowledgeApplyHandlePageDto>> GetApplyList(KnowledgeApplyPagedDto pagedDto, CancellationToken cancellationToken);

        /// <summary>
        /// 申请处理查询
        /// </summary>
        /// <param name="pagedDto"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<PagedDto<KnowledgeApplyHandlePageDto>> GetApplyHandleList(KnowledgeHandlePagedDto pagedDto, CancellationToken cancellationToken);

        /// <summary>
        /// 批量导出知识详情
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<Dictionary<string, Stream>> KnowledgeInfoListExportAsync(KnowledgeInfoExportInDto dto, CancellationToken cancellationToken);

        /// <summary>
        /// 知识标题分词
        /// </summary>
        /// <param name="keywords"></param>
        /// <param name="title"></param>
        /// <returns></returns>
        Task<IList<KnowledgeWordOutDto>> TitleParticiple(string title);

        /// <summary>
        /// 知识库浏览历史
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="requestAborted"></param>
        /// <returns></returns>
        Task<(int, IList<PageViewOutDto>)> GetPageViewListAsync(PageViewInDto dto, CancellationToken requestAborted = default);

        /// <summary>
        /// 热词集合
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="requestAborted"></param>
        /// <returns></returns>
        Task<(int total, IList<KnowledgeHotWordOutDto> items)> GetKnowledgeHotWordListAsync(KnowledgeHotWordInDto dto, CancellationToken requestAborted);

        /// <summary>
        /// 修改热词
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="requestAborted"></param>
        /// <returns></returns>
        Task UpdateKnowledgeHotWordAsync(UpdateKnowledgeHotWordInDto dto, CancellationToken requestAborted = default);
        Task AddKnowledgeHotWordAsync(AddKnowledgeHotWordInDto dto, CancellationToken requestAborted = default);

        /// <summary>
        /// 知识检索
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<(int, List<KnowledgeRetrievalDataDto>)> KnowRetrievalAsync(KnowledgeRetrievalPagedListDto dto);

        /// <summary>
        /// 知识超期未更新统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        ISugarQueryable<KnowedgeStatisticsDto> GetKnowedgeStatistics(PagedKeywordRequest dto);
    }
}
