using System.Threading.Tasks;
using System.Collections.Generic;
using NPP.SmartSchedue.Api.Contracts.Services.Notification.Input;
using NPP.SmartSchedue.Api.Contracts.Services.Notification.Output;

namespace NPP.SmartSchedue.Api.Contracts.Services.Notification;

/// <summary>
/// 系统消息服务接口
/// 决策点1：基础通知方式 - 系统消息通知
/// </summary>
public interface ISystemMessageService
{
    #region 单个消息发送
    
    /// <summary>
    /// 发送系统消息
    /// </summary>
    /// <param name="input">发送系统消息输入模型</param>
    /// <returns>发送结果</returns>
    Task<SendSystemMessageOutput> SendSystemMessageAsync(SendSystemMessageInput input);

    /// <summary>
    /// 发送带操作按钮的系统消息
    /// </summary>
    /// <param name="input">发送带操作按钮的系统消息输入模型</param>
    /// <returns>发送结果</returns>
    Task<SendSystemMessageOutput> SendSystemMessageWithActionsAsync(SendSystemMessageWithActionsInput input);

    #endregion

    #region 批量消息发送
    
    /// <summary>
    /// 批量发送系统消息
    /// </summary>
    /// <param name="input">批量发送系统消息输入模型</param>
    /// <returns>批量发送结果</returns>
    Task<BatchSendSystemMessageOutput> BatchSendSystemMessageAsync(BatchSendSystemMessageInput input);

    /// <summary>
    /// 个性化批量发送系统消息
    /// 每个收件人可以有不同的消息内容
    /// </summary>
    /// <param name="messageItems">消息项列表</param>
    /// <returns>批量发送结果</returns>
    Task<BatchSendSystemMessageOutput> BatchSendPersonalizedSystemMessageAsync(List<SystemMessageItem> messageItems);

    #endregion

    #region 消息模板
    
    /// <summary>
    /// 使用模板发送系统消息
    /// </summary>
    /// <param name="input">使用模板发送系统消息输入模型</param>
    /// <returns>发送结果</returns>
    Task<SendSystemMessageOutput> SendSystemMessageByTemplateAsync(SendSystemMessageByTemplateInput input);

    #endregion

    #region 消息管理
    
    /// <summary>
    /// 标记消息为已读
    /// </summary>
    /// <param name="messageId">消息ID</param>
    /// <param name="recipientPersonnelId">接收人员ID</param>
    /// <returns>操作结果</returns>
    Task<SystemMessageStatusOutput> MarkMessageAsReadAsync(long messageId, long recipientPersonnelId);

    /// <summary>
    /// 批量标记消息为已读
    /// </summary>
    /// <param name="messageIds">消息ID列表</param>
    /// <param name="recipientPersonnelId">接收人员ID</param>
    /// <returns>操作结果</returns>
    Task<SystemMessageStatusOutput> BatchMarkMessagesAsReadAsync(List<long> messageIds, long recipientPersonnelId);

    /// <summary>
    /// 删除消息
    /// </summary>
    /// <param name="messageId">消息ID</param>
    /// <param name="recipientPersonnelId">接收人员ID</param>
    /// <returns>操作结果</returns>
    Task<SystemMessageStatusOutput> DeleteMessageAsync(long messageId, long recipientPersonnelId);

    /// <summary>
    /// 获取用户未读消息数量
    /// </summary>
    /// <param name="recipientPersonnelId">接收人员ID</param>
    /// <returns>未读消息数量</returns>
    Task<int> GetUnreadMessageCountAsync(long recipientPersonnelId);

    #endregion
}