using System;
using System.Collections.Generic;
using NPP.SmartSchedue.Api.Contracts.Core.Enums;

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

/// <summary>
/// 发送通知输出
/// </summary>
public class SendNotificationOutput
{
    #region 总体结果
    
    /// <summary>
    /// 是否全部发送成功
    /// </summary>
    public bool IsAllSuccess { get; set; } = true;

    /// <summary>
    /// 总共发送数量
    /// </summary>
    public int TotalCount { get; set; } = 0;

    /// <summary>
    /// 成功发送数量
    /// </summary>
    public int SuccessCount { get; set; } = 0;

    /// <summary>
    /// 失败发送数量
    /// </summary>
    public int FailedCount { get; set; } = 0;

    /// <summary>
    /// 总体错误信息
    /// </summary>
    public string OverallErrorMessage { get; set; } = "";

    #endregion

    #region 详细结果
    
    /// <summary>
    /// 每个接收人的发送结果详情
    /// </summary>
    public List<NotificationSendResult> SendResults { get; set; } = new List<NotificationSendResult>();

    #endregion

    #region 批量任务信息
    
    /// <summary>
    /// 创建的通知历史记录ID列表
    /// </summary>
    public List<long> NotificationHistoryIds { get; set; } = new List<long>();

    /// <summary>
    /// 发送时间
    /// </summary>
    public DateTime SendTime { get; set; } = DateTime.Now;

    #endregion
}

/// <summary>
/// 单个通知发送结果
/// </summary>
public class NotificationSendResult
{
    /// <summary>
    /// 接收人员ID
    /// </summary>
    public long RecipientPersonnelId { get; set; }

    /// <summary>
    /// 接收人员姓名
    /// </summary>
    public string RecipientPersonnelName { get; set; } = "";

    /// <summary>
    /// 接收人员邮箱
    /// </summary>
    public string RecipientEmail { get; set; } = "";

    /// <summary>
    /// 通知方式
    /// </summary>
    public NotificationTypeEnum NotificationType { get; set; }

    /// <summary>
    /// 发送状态
    /// </summary>
    public NotificationStatusEnum SendStatus { get; set; } = NotificationStatusEnum.Pending;

    /// <summary>
    /// 发送结果信息
    /// </summary>
    public string SendResult { get; set; } = "";

    /// <summary>
    /// 错误信息
    /// </summary>
    public string ErrorMessage { get; set; } = "";

    /// <summary>
    /// 通知历史记录ID
    /// </summary>
    public long NotificationHistoryId { get; set; }

    /// <summary>
    /// 发送时间
    /// </summary>
    public DateTime? SendTime { get; set; }
}