using YBEE.EQM.Core;

namespace YBEE.EQM.Application;

/// <summary>
/// 家长问卷填答进度管理服务
/// </summary>
[ApiDescriptionSettings(Name = "exam-patriarch-questionnaire-progress")]
[Route("exam/patriarch/questionnaire/progress")]
public class ExamPatriarchQuestionnaireProgressAppService : IDynamicApiController
{
    private readonly IExamPatriarchQuestionnaireProgressService _examPatriarchQuestionnaireProgressService;

    public ExamPatriarchQuestionnaireProgressAppService(IExamPatriarchQuestionnaireProgressService examPatriarchQuestionnaireProgressService)
    {
        _examPatriarchQuestionnaireProgressService = examPatriarchQuestionnaireProgressService;
    }

    /// <summary>
    /// 查询学生家长问卷明细
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task<PageResult<ExamStudentPatriarchQuestionnaireProgressOutput>> QueryPageList(ExamStudentPatriarchQuestionnaireProgressPageInput input)
    {
        return await _examPatriarchQuestionnaireProgressService.QueryPageList(input);
    }
    /// <summary>
    /// 导出未填答学生名单
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task<IActionResult> ExportUncompletedExcel(ExportExamPatriarchQuestionnaireProgressInput input)
    {
        var bs = await _examPatriarchQuestionnaireProgressService.ExportUncompletedExcel(input);
        return new FileContentResult(bs, "application/octet-stream")
        {
            FileDownloadName = "学生家长问卷未填答名单.xlsx",
        };
    }
    /// <summary>
    /// 获取各班级问卷填答进度
    /// </summary>
    /// <param name="examPlanId"></param>
    /// <returns></returns>
    public async Task<List<ExamStudentPatriarchQuestionnaireProgressStatOutput>> GetProgressList([FromQuery][Required] int examPlanId)
    {
        return await _examPatriarchQuestionnaireProgressService.GetProgressList(examPlanId);
    }
}
