using YBEE.EQM.Core;

namespace YBEE.EQM.Application;

/// <summary>
/// 机构信息服务
/// </summary>
[ApiDescriptionSettings(Name = "sys-org")]
[Route("sys/org")]
public class SysOrgAppService : IDynamicApiController
{
    private readonly ISysOrgService _sysOrgService;
    public SysOrgAppService(ISysOrgService sysOrgService)
    {
        _sysOrgService = sysOrgService;
    }

    /// <summary>
    /// 添加机构
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task Add(AddSysOrgInput input)
    {
        await _sysOrgService.Add(input);
    }
    /// <summary>
    /// 更新机构
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task Update(UpdateSysOrgInput input)
    {
        await _sysOrgService.Update(input);
    }
    /// <summary>
    /// 删除机构
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task Del(BaseId<short> input)
    {
        await _sysOrgService.Del(input);
    }
    /// <summary>
    /// 启用禁用机构
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task ChangeStatus(BaseId<short> input)
    {
        await _sysOrgService.ChangeStatus(input);
    }
    /// <summary>
    /// 根据ID获取机构
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public async Task<SysOrgOutput> GetById([FromQuery][Required] short id)
    {
        return await _sysOrgService.GetById(id);
    }
    /// <summary>
    /// 查询机构列表
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task<List<SysOrgLiteOutput>> QueryList(QuerySysOrgInput input)
    {
        return await _sysOrgService.QueryList(input);
    }
    /// <summary>
    /// 分页查询机构列表
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task<PageResult<SysOrgOutput>> QueryPageList(SysOrgPageInput input)
    {
        return await _sysOrgService.QueryPageList(input);
    }
    /// <summary>
    /// 获取全部机构列表
    /// </summary>
    /// <returns></returns>
    public async Task<List<SysOrgLiteOutput>> GetAllList()
    {
        return await _sysOrgService.GetAllList();
    }
    /// <summary>
    /// 根据学校ID获取校区列表
    /// </summary>
    /// <param name="orgId"></param>
    /// <returns></returns>
    public async Task<List<SysOrgLiteOutput>> GetOrgBranchByOrgId([FromQuery][Required] short orgId)
    {
        return await _sysOrgService.GetOrgBranchByOrgId(orgId);
    }
}
