using YBEE.EQM.Core;

namespace YBEE.EQM.Application;

/// <summary>
/// 监测发布内容管理服务
/// </summary>
public class ExamDataPublishAppService : IDynamicApiController
{
    private readonly IExamDataPublishService _examDataPublishService;

    public ExamDataPublishAppService(IExamDataPublishService examDataPublishService)
    {
        _examDataPublishService = examDataPublishService;
    }

    #region 创建更新
    /// <summary>
    /// 添加发布内容
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task Add(AddExamDataPublishInput input)
    {
        await _examDataPublishService.Add(input);
    }
    /// <summary>
    /// 更新发布内容
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task Update(UpdateExamDataPublishInput input)
    {
        await _examDataPublishService.Update(input);
    }
    /// <summary>
    /// 删除发布内容
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task Del(BaseId input)
    {
        await _examDataPublishService.Del(input);
    }
    #endregion

    #region 状态处理
    /// <summary>
    /// 发布
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task Publish(BaseId input)
    {
        await _examDataPublishService.Publish(input);
    }
    /// <summary>
    /// 取消
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    public async Task Unpublish(BaseId input)
    {
        await _examDataPublishService.Unpublish(input);
    }
    #endregion

    #region 查询
    /// <summary>
    /// 根据ID获取监测数据发布内容
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public async Task<ExamDataPublishOutput> GetById(int id)
    {
        return await _examDataPublishService.GetById(id);
    }
    /// <summary>
    /// 根据监测计划ID获取数据发布内容列表
    /// </summary>
    /// <param name="examPlanId"></param>
    /// <returns></returns>
    public async Task<List<ExamDataPublishOutput>> GetListByExamPlanId(int examPlanId)
    {
        return await _examDataPublishService.GetListByExamPlanId(examPlanId);
    }
    #endregion
}
