using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using GxPress.Entity.Middle;
using GxPress.Request.Notice;
using SqlKata;
using Datory;
using GxPress.Request.App.Middle;

namespace GxPress.Repository.Interface
{
    public interface IMiddleRepository : IRepository
    {
        Task<int> InsertAsync(Middle middle);
        Task<bool> UpdateAsync(SqlKata.Query query);
        Task<bool> UpdateAsync(Middle middle);
        Task<IEnumerable<Middle>> FindAsync(SqlKata.Query query);

        Task<bool> DeleteAsync(SqlKata.Query query);

        Task<Middle> GetMiddleAsync(Query query);

        Task<Middle> GetMiddleAsync(int id);

        Task<bool> SetSortAsync(MiddleSortRequest request);
        Task<bool> SetTopAsync(int id);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        Task<bool> DeleteAsync(NoticeDeRequest request);

        /// <summary>
        /// 阅读
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<bool> ReadAsync(int id);

        /// <summary>
        /// 恢复删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        Task<bool> RecoverDeleteAsync(NoticeDeRequest request);

        Task<bool> UpdateFolderNameAsync(MiddleFolderNameRequest request);

        Task<bool> IsFolderAsync(int parentId);

        /// <summary>
        /// 根据用户ID文件夹ID查询小组数量
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="folderId"></param>
        /// <param name="folderTypeId"></param>
        /// <returns></returns>
        Task<int> FindGroupCountAsync(int userId, int folderId, int folderTypeId);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        Task<int> CountAsync(SqlKata.Query query);
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="middle"></param>
        /// <returns></returns>
        Task<bool> InsertAsync(List<Middle> middles);

        Task<IEnumerable<Middle>> GetAllAsync(SqlKata.Query query);

        /// <summary>
        /// 获取下级数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<IEnumerable<Middle>> GetMiddleChildrenAsync(int id);
    }
}
