using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using MDL.Models;

namespace BLL.Interfaces
{
    /// <summary>
    /// Excel导入服务接口
    /// </summary>
    public interface IExcelImportService
    {
        /// <summary>
        /// 导入货物数据（中性面单、大包号、提单号）
        /// </summary>
        /// <param name="excelStream">Excel文件流</param>
        /// <param name="customerId">客户ID（可选）</param>
        /// <param name="importedBy">导入人（可选）</param>
        /// <returns>导入结果</returns>
        Task<ImportResult> ImportCargoDataAsync(Stream excelStream, int? customerId = null, string importedBy = "System");
        
        /// <summary>
        /// 导出Excel模板
        /// </summary>
        /// <returns>Excel模板文件流</returns>
        Task<byte[]> ExportTemplateAsync();
        
        /// <summary>
        /// 查询货物数据
        /// </summary>
        /// <param name="searchKey">搜索关键字（中性面单/提单号/大包号）</param>
        /// <param name="customerId">客户ID（可选）</param>
        /// <param name="pageIndex">页码（默认1）</param>
        /// <param name="pageSize">每页记录数（默认100）</param>
        /// <returns>货物数据列表</returns>
        Task<IEnumerable<CargoDataEntity>> QueryCargoDataAsync(string? searchKey = null, int? customerId = null, int pageIndex = 1, int pageSize = 100);
        
        /// <summary>
        /// 根据中性面单单号查询货物数据
        /// </summary>
        /// <param name="neutralWaybillNumber">中性面单单号</param>
        /// <returns>货物数据实体</returns>
        Task<CargoDataEntity?> GetCargoDataByWaybillNumberAsync(string neutralWaybillNumber);
        
        /// <summary>
        /// 验证Excel数据行
        /// </summary>
        /// <param name="excelRow">Excel数据行</param>
        /// <returns>验证结果（true为通过，false为失败）</returns>
        bool ValidateExcelRow(ExcelImportRow excelRow);
    }
}