namespace YBEE.EQM.Application;

/// <summary>
/// 高中模拟分析导出服务
/// </summary>
[ApiDescriptionSettings(Name = "ncee-export")]
[Route("ncee/export")]
public class NceeExportAppService(INceeExportService nceeExportService) : IDynamicApiController
{
    private readonly INceeExportService _nceeExportService = nceeExportService;

    /// <summary>
    /// 导出联盟区县模拟划线报表
    /// </summary>
    /// <param name="nceePlanId"></param>
    /// <returns></returns>
    public async Task<IActionResult> ExportAllianceDistrict([FromQuery][Required] int nceePlanId)
    {
        var (fileName, fileBytes) = await _nceeExportService.ExportAllianceDistrict(nceePlanId);
        return new FileContentResult(fileBytes, "application/octet-stream")
        {
            FileDownloadName = fileName,
        };
    }
    /// <summary>
    /// 导出已选科的模拟划线报表
    /// </summary>
    /// <param name="input">导出参数</param>
    /// <returns></returns>
    public async Task<IActionResult> ExportDirectionSeleted(NceeExportInput input)
    {
        var (fileName, fileBytes) = await _nceeExportService.ExportDirectionSeleted(input);
        return new FileContentResult(fileBytes, "application/octet-stream")
        {
            FileDownloadName = fileName,
        };
    }
    /// <summary>
    /// 导出未选科的模拟划线报表
    /// </summary>
    /// <param name="nceePlanId"></param>
    /// <returns></returns>
    public async Task<IActionResult> ExportDirectionUnseleted([FromQuery][Required] int nceePlanId)
    {
        var (fileName, fileBytes) = await _nceeExportService.ExportDirectionUnseleted(nceePlanId);
        return new FileContentResult(fileBytes, "application/octet-stream")
        {
            FileDownloadName = fileName,
        };
    }
}
