using YBEE.EQM.Core;

namespace YBEE.EQM.Application;

/// <summary>
/// 学期信息管理服务
/// </summary>
[ApiDescriptionSettings(Name = "base-semester")]
[Route("base/semester")]
public class SemesterAppService : IDynamicApiController
{
    private readonly ISemesterService _semesterService;
    public SemesterAppService(ISemesterService semesterService)
    {
        _semesterService = semesterService;
    }

    /// <summary>
    /// 添加学期
    /// </summary>
    /// <returns></returns>
    public async Task Add()
    {
        await _semesterService.Add();
    }
    /// <summary>
    /// 设置当前学期
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task SetCurrent(BaseId<short> input)
    {
        await _semesterService.SetCurrent(input);
    }
    /// <summary>
    /// 根据ID获取单个学期
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public async Task<SemesterOutput> GetById([FromQuery][Required] int id)
    {
        return await _semesterService.GetById(id);
    }
    /// <summary>
    /// 获取当前学期
    /// </summary>
    /// <returns></returns>
    public async Task<SemesterOutput> GetCurrent()
    {
        return await _semesterService.GetCurrent();
    }
    /// <summary>
    /// 获取全部学期信息列表
    /// </summary>
    /// <returns></returns>
    public async Task<List<SemesterOutput>> GetAllList()
    {
        return await _semesterService.GetAllList();
    }
}
