namespace Tiobon.Core.Api.Controllers;

/// <summary>
/// 考试(Controller)
/// </summary>
[Route("api/[controller]")]
[ApiController, GlobalActionFilter]
[Authorize(Permissions.Name), ApiExplorerSettings(GroupName = Grouping.GroupName_Ghre)]
public class Ghre_ExamController : BaseController<IGhre_ExamServices, Ghre_Exam, Ghre_ExamDto, InsertGhre_ExamInput, EditGhre_ExamInput>
{
    public Ghre_ExamController(IGhre_ExamServices service) : base(service)
    {
    }

    #region 查询初始化数据
    /// <summary>
    ///  查询初始化数据
    /// </summary> 
    /// <returns></returns>
    [HttpPost, Route("GetModuleInfo")]
    public async Task<dynamic> GetModuleInfo([FromBody] ModuleParam param)
    {
        return await _service.GetModuleInfo(param);
    }

    #endregion

    #region 根据条件查询数据
    /// <summary>
    /// 根据条件查询数据
    /// </summary>
    /// <param name="status">status</param>
    /// <param name="body">条件</param>
    /// <returns></returns>
    [HttpPost, Route("QueryList/{status}")]
    public async Task<dynamic> QueryList(string status, [FromBody] QueryBody body)
    {
        return await _service.QueryList(body, status);
    }

    #endregion

    #region 查询明细数据
    /// <summary>
    /// 查询明细数据
    /// </summary>
    /// <param name="id">id</param>
    /// <returns></returns>
    [HttpPost, Route("QueryDefault/{id}")]
    public async Task<ServiceResult<DefaultGhre_ExamInput>> QueryDefault(long id)
    {
        return await _service.QueryDefault(id);
    }

    #endregion


    #region 根据员工ID查询员工数据
    /// <summary>
    /// 根据员工ID查询员工数据
    /// </summary>
    /// <param name="Ids">Ids</param>
    /// <param name="type">type</param>
    /// <returns></returns>
    [HttpPost, Route("QueryStaff/{type}")]
    public async Task<ServiceResult<List<StaffTableData>>> QueryStaff([FromBody] List<int> Ids, string type)
    {
        return await _service.QueryStaff(Ids, type);
    }

    #endregion


    #region 新增
    /// <summary>
    /// 新增
    /// </summary>
    /// <param name="id">id</param> 
    /// <param name="pageData">pageData</param> 
    /// <returns></returns>
    [HttpPost("Insert1/{id}")]
    public async Task<ServiceResult<long>> Insert1(long id, [FromBody] DefaultGhre_ExamPageData pageData)
    {
        return await _service.Insert1(id, pageData);
    }

    #endregion


    #region 更新考试状态接口
    /// <summary>
    /// 更新考试状态接口
    /// </summary>
    /// <param name="ids"></param>
    /// <param name="status"></param>
    /// <returns></returns>
    [HttpPost("UpdateStatus/{status}")]
    public async Task<ServiceResult> UpdateStatus([FromBody] long[] ids, string status)
    {
        return await _service.UpdateStatus(ids, status);
    }
    #endregion

    #region 获取考试状态接口
    /// <summary>
    /// 获取考试状态接口
    /// </summary>
    /// <param name="id"></param> 
    /// <returns></returns>
    [HttpPost("GetStatus/{id}")]
    public async Task<ServiceResult> GetStatus(long id)
    {
        return await _service.GetStatus(id);
    }
    #endregion

    #region 开始考试
    /// <summary>
    /// 开始考试
    /// </summary>
    /// <param name="id">考试ID</param>  
    /// <returns></returns>
    [HttpPost("StartExam/{id}")]
    public async Task<ServiceResult> StartExam(long id)
    {
        return await _service.StartExam(id);
    }
    #endregion

    #region 复制
    /// <summary>
    /// 复制
    /// </summary>
    /// <param name="id">考试ID</param>  
    /// <returns></returns>
    [HttpPost("Copy/{id}")]
    public async Task<ServiceResult> Copy(long id)
    {
        return await _service.Copy(id);
    }
    #endregion

    #region 查询考试通知记录
    /// <summary>
    /// 查询考试通知记录接口
    /// </summary>
    /// <param name="id">考试ID</param>  
    /// <returns></returns>
    [HttpPost("QueryMessageLog/{id}")]
    public async Task<ServiceResult<Ghre_ExamMessageLogDto>> QueryMessageLog(long id)
    {
        return await _service.QueryMessageLog(id);
    }
    #endregion

    #region 提交考试通知记录
    /// <summary>
    /// 提交考试通知记录
    /// </summary>
    /// <param name="insert">insert</param>  
    /// <returns></returns>
    [HttpPost("InsertMessageLog")]
    public async Task<ServiceResult> InsertMessageLog([FromBody] Ghre_ExamMessageLogDto insert)
    {
        return await _service.InsertMessageLog(insert);
    }
    #endregion


    [HttpPost, Route("ExportExcel/{status}")]
    public async Task<ServiceResult<string>> ExportExcel([FromBody] QueryExport body, string status)
    {
        return await _service.ExportExcel(body, status);
    }

    #region 获取考试关联人员
    /// <summary>
    /// 获取考试关联人员
    /// </summary>
    /// <param name="id">id</param> 
    /// <returns></returns>
    [HttpPost, Route("QueryRuleStaff/{id}")]
    public async Task<ServiceResult<List<StaffTableData>>> QueryRuleStaff(long id)
    {
        return await _service.QueryRuleStaff(id);
    }

    #endregion
    [HttpPost, Route("ExecuteExamOver")]
    public async Task<ServiceResult> ExecuteExamOver()
    {
        return await _service.ExecuteExamOver();
    }



}