using Hotline.Share.Dtos.CallCenter;
using Hotline.Share.Dtos.Order;
using Hotline.Share.Enums.Article;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hotline.Application.ExportExcel
{
    public interface IExportApplication
    {
        /// <summary>
        /// 导出数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list">数据集List<T></param>
        /// <param name="name">导出文件名（不传则生成yyyyMMddhhmmss）</param>
        /// <returns></returns>
        FileStreamResult ExportData<T>(IList<T> list, string? name);

        Stream GetExcelStream<T, D>(ExportExcelDto<D> dto, IList<T> items, Func<IList<T>, T>? func = null);

        FileStreamResult GetExcelFile<T, D>(ExportExcelDto<D> dto, IList<T> items,string fileName, Func<IList<T>, T>? func = null);

        FileStreamResult GetExcelFile(Type typeT, Type typeD, object dto, IList<object> items, string fileName);
        FileStreamResult GetExcelFile(Type typeT, Type typeD, object dto, IList<object> items, string fileName, string? totalFiledName);

        /// <summary>
        /// 导入数据
        /// </summary>
        /// <typeparam name="T">导出数据的类型</typeparam>
        /// <typeparam name="D">导出请求入参类型</typeparam>
        /// <param name="dto">请求入参</param>
        /// <param name="items">被导出的数据</param>
        /// <param name="fileName">excel 文件名</param>
        /// <param name="totalName">需要填写"统计"两字的字段名称, 字段名称必须是 T 中的字段</param>
        /// <returns></returns>
        FileStreamResult GetExcelFile<T, D>(ExportExcelDto<D> dto, IList<T> items, string fileName, string totalName) where T : new();
    }
}
