using YBEE.EQM.Core;

namespace YBEE.EQM.Application;

/// <summary>
/// 监测抽样方案管理服务
/// </summary>
public interface IExamSampleService
{
    /// <summary>
    /// 添加监测抽样方案
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task Add(AddExamSampleInput input);
    /// <summary>
    /// 更新监测抽样方案
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task Update(UpdateExamSampleInput input);
    /// <summary>
    /// 复制抽样方案信息
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task Duplicate(BaseId input);
    /// <summary>
    /// 删除监测抽样方案
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task Del(BaseId input);
    /// <summary>
    /// 保存全抽班级ID列表
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task SaveExamSampleAllClasses(SaveExamSampleAllClasses input);
    /// <summary>
    /// 切换全抽班级
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task SwitchExamSampleAllClass(SwitchExamSampleAllClassInput input);
    /// <summary>
    /// 选定方案
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task SelectSample(BaseId input);


    /// <summary>
    /// 执行抽样
    /// </summary>
    /// <param name="input">抽样方案ID</param>
    /// <returns></returns>
    /// <exception cref="Exception"></exception>
    Task ExecuteSample(BaseId input);

    /// <summary>
    /// 导出抽样方案存档文件
    /// </summary>
    /// <param name="id"></param>
    /// <param name="hideIdNumber"></param>
    /// <returns></returns>
    Task<(string fileName, byte[] fileBytes)> ExportToArchived(int id, bool hideIdNumber = false);
    /// <summary>
    /// 导出给印刷厂和网阅机构文件
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<(string fileName, byte[] fileBytes)> ExportToPrintshop(int id);
    /// <summary>
    /// 导出给学校
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<(string fileName, byte[] fileBytes)> ExportToOrg(int id);
    /// <summary>
    /// 导出抽样统计表
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<(string fileName, byte[] fileBytes)> ExportSampleCount(int id);
    /// <summary>
    /// 导出学校抽样统计表
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<(string fileName, byte[] fileBytes)> ExportSampleCountToOrg(int id);


    /// <summary>
    /// 根据ID获取抽样方案
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<ExamSampleOutput> GetById(int id);
    /// <summary>
    /// 根据监测计划ID获取全部抽样方案
    /// </summary>
    /// <param name="examPlanId"></param>
    /// <returns></returns>
    Task<List<ExamSampleOutput>> GetListByExamPlanId(int examPlanId);
    /// <summary>
    /// 查询已发布抽样
    /// </summary>
    /// <param name="examDataPublishId">监测发布内容ID</param>
    /// <param name="type">抽样数据发布类型</param>
    /// <returns></returns>
    Task<ExamSamplePlanOutput> GetByExamDataPublishId(int examDataPublishId, DataPublishType type);

    /// <summary>
    /// 获取抽样统计表
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<List<ExamSampleCountOutput>> GetSampleCountListById(int id);
    /// <summary>
    /// 获取学校抽样统计表
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    Task<List<ExamSampleCountOutput>> GetOrgSampleCountListById(int id);
}
